Files
Atomcms-edit/frontend/.next/server/chunks/ssr/[root-of-the-server]__0znoc1w._.js
T
2026-05-09 17:32:17 +02:00

3 lines
3.8 KiB
JavaScript
Executable File

module.exports=[18622,(a,b,c)=>{b.exports=a.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},20635,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},43285,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/dynamic-access-async-storage.external.js",()=>require("next/dist/server/app-render/dynamic-access-async-storage.external.js"))},42602,(a,b,c)=>{"use strict";b.exports=a.r(18622)},87924,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].ReactJsxRuntime},72131,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].React},9270,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored.contexts.AppRouterContext},38783,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].ReactServerDOMTurbopackClient},35112,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored["react-ssr"].ReactDOM},36313,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored.contexts.HooksClientContext},18341,(a,b,c)=>{"use strict";b.exports=a.r(42602).vendored.contexts.ServerInsertedHtml},19032,a=>{"use strict";async function b(a,c={}){let d={"Content-Type":"application/json",Accept:"application/json",...c.headers};try{let b=await fetch(`/api${a}`,{...c,headers:d}),e=await b.json();if(!b.ok)return{error:e.message||e.errors||"Something went wrong"};return{data:e}}catch(a){return{error:"Network error occurred"}}}let c={get:a=>b(a),post:(a,c)=>b(a,{method:"POST",body:JSON.stringify(c)}),put:(a,c)=>b(a,{method:"PUT",body:JSON.stringify(c)}),delete:a=>b(a,{method:"DELETE"})};a.s(["api",0,c,"auth",0,{login:(a,b)=>c.post("/auth/login",{username:a,password:b}),register:a=>c.post("/auth/register",a),logout:()=>c.post("/auth/logout",{}),user:()=>c.get("/auth/user")},"radio",0,{getCurrentDJ:()=>c.get("/radio/current-dj"),getNowPlaying:()=>c.get("/radio/now-playing"),getListeners:()=>c.get("/radio/listeners"),getConfig:()=>c.get("/radio/config"),getShouts:()=>c.get("/radio/shouts"),getPoints:()=>c.get("/radio/points")},"users",0,{getByUsername:a=>c.get(`/user/${a}`),getProfile:a=>c.get(`/profile/${a}`)}])},56025,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(19032);let e=(0,c.createContext)(void 0);a.s(["AuthProvider",0,function({children:a}){let[f,g]=(0,c.useState)(null),[h,i]=(0,c.useState)(!0);(0,c.useEffect)(()=>{let a=localStorage.getItem("token"),b=localStorage.getItem("user");a&&b?(g(JSON.parse(b)),d.auth.user().then(({data:a,error:b})=>{a?(g(a),localStorage.setItem("user",JSON.stringify(a))):(localStorage.removeItem("token"),localStorage.removeItem("user"),g(null)),i(!1)})):i(!1)},[]);let j=async()=>{await d.auth.logout(),localStorage.removeItem("token"),localStorage.removeItem("user"),g(null)},k=async()=>{let{data:a}=await d.auth.user();a&&(g(a),localStorage.setItem("user",JSON.stringify(a)))};return(0,b.jsx)(e.Provider,{value:{user:f,loading:h,login:(a,b)=>{localStorage.setItem("token",a),localStorage.setItem("user",JSON.stringify(b)),g(b)},logout:j,refreshUser:k},children:a})},"useAuth",0,function(){let a=(0,c.useContext)(e);if(void 0===a)throw Error("useAuth must be used within an AuthProvider");return a}])}];
//# sourceMappingURL=%5Broot-of-the-server%5D__0znoc1w._.js.map