(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2990],{5040:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>r});var a=t(5155),o=t(2115);function r(){let[e,s]=(0,o.useState)("Testing..."),[t,r]=(0,o.useState)(null),[l,c]=(0,o.useState)(null),[n,i]=(0,o.useState)([]);return(0,o.useEffect)(()=>{(async()=>{let e="http://localhost:8000/api";console.log("API Base URL:",e),i(s=>[...s,"API Base URL: ".concat(e)]);try{s("Testing basic connectivity...");let t=await fetch("".concat(e,"/categories"));if(console.log("Categories response status:",t.status),i(e=>[...e,"Categories response status: ".concat(t.status)]),t.ok){let e=await t.json();console.log("Categories data:",e),r(e),s("Categories loaded successfully!")}else s("Categories failed: ".concat(t.status," ").concat(t.statusText))}catch(e){console.error("Categories error:",e),s("Categories error: ".concat(e)),i(s=>[...s,"Categories error: ".concat(e)])}try{let s=await fetch("".concat(e,"/products"));if(console.log("Products response status:",s.status),i(e=>[...e,"Products response status: ".concat(s.status)]),s.ok){let e=await s.json();console.log("Products data:",e),c(e)}else i(e=>[...e,"Products failed: ".concat(s.status," ").concat(s.statusText)])}catch(e){console.error("Products error:",e),i(s=>[...s,"Products error: ".concat(e)])}})()},[]),(0,a.jsxs)("div",{className:"container mx-auto p-8",children:[(0,a.jsx)("h1",{className:"text-3xl font-bold mb-8",children:"API Debug Page"}),(0,a.jsxs)("div",{className:"mb-8 p-4 bg-gray-100 rounded",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"API Status"}),(0,a.jsx)("p",{children:e})]}),(0,a.jsxs)("div",{className:"mb-8 p-4 bg-red-50 rounded",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Debug Log"}),n.map((e,s)=>(0,a.jsx)("p",{className:"text-sm font-mono",children:e},s))]}),t&&(0,a.jsxs)("div",{className:"mb-8 p-4 bg-green-50 rounded",children:[(0,a.jsxs)("h2",{className:"text-xl font-semibold mb-2",children:["Categories (",Array.isArray(t)?t.length:"Not array",")"]}),(0,a.jsx)("pre",{className:"text-xs overflow-auto max-h-40",children:JSON.stringify(t,null,2)})]}),l&&(0,a.jsxs)("div",{className:"mb-8 p-4 bg-blue-50 rounded",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Products"}),(0,a.jsxs)("p",{children:["Data type: ",Array.isArray(null==l?void 0:l.data)?"Array":typeof(null==l?void 0:l.data)]}),(0,a.jsxs)("p",{children:["Count: ",Array.isArray(null==l?void 0:l.data)?l.data.length:"Unknown"]}),(0,a.jsx)("pre",{className:"text-xs overflow-auto max-h-40",children:JSON.stringify(l,null,2)})]})]})}},9387:(e,s,t)=>{Promise.resolve().then(t.bind(t,5040))}},e=>{var s=s=>e(e.s=s);e.O(0,[8441,1684,7358],()=>s(9387)),_N_E=e.O()}]);