(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3783],{7796:(e,r,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/[user_id]/su/error-logs",function(){return s(8416)}])},8416:(e,r,s)=>{"use strict";s.r(r),s.d(r,{__N_SSP:()=>c,default:()=>d});var t=s(4848),n=s(6540),o=s(9020),a=s(1710);function l(){let[e,r]=n.useState(null),[s,l]=n.useState(!1),[i,c]=n.useState(0);function d(){(0,o.A)("/api/admin/grabErrorLogs").then(e=>{var s;if("string"!=typeof e.log||(null===(s=e.log)||void 0===s?void 0:s.match(/./)))r("");else{r("No Logs Yet");return}r(e.log.replace(/\n|\r|\n\r|\\n/gm,"<br/>"))})}return n.useEffect(()=>{d(),0===i&&setInterval(()=>{d()},1e4)},[i]),(0,t.jsxs)(n.Fragment,{children:[(0,t.jsxs)("div",{className:"w-full justify-between",children:[(0,t.jsx)("h2",{className:"text-xl m-0",children:"Error Logs"}),(0,t.jsx)("div",{children:(0,t.jsxs)("button",{onClick:e=>{window.confirm("Clear Error Logs?")&&(l(!0),(0,o.A)("/api/admin/clearErrorLogs",{method:"POST"}).then(e=>{console.log(e),c(e=>e+1)}),setTimeout(()=>{l(!1)},2e3))},className:"outlined gray relative",children:[s&&(0,t.jsx)(a.A,{width:"20px"}),"Clear Error Log"]})})]}),(0,t.jsxs)("section",{className:"paper",children:[e&&(0,t.jsx)("p",{dangerouslySetInnerHTML:{__html:e||"No Log"}}),!e&&(0,t.jsx)(a.A,{position:"relative",width:"25px"})]})]})}var i=s(4725),c=!0;function d(e){let{user:r,data:s}=e,n=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,t.jsx)("meta",{name:"description",content:"Welcome to your data app"})]});return(0,t.jsx)(i.A,{head:n,children:(0,t.jsx)(l,{})})}}},e=>{var r=r=>e(e.s=r);e.O(0,[1335,3348,4725,636,6593,8792],()=>r(7796)),_N_E=e.O()}]);