PageSourceSearch

https://www.reznicka.cz/_nuxt/BSbdeeAZ.js

js reznicka.cz collected 2026-10-02 11:58:30 UTC 2,181 bytes, 1 lines download raw bytes

1import{D as L,ab as E,aC as y,aD as S,f as k,aE as C,W as l,Z as r,aF as A}from"./z-NznDjK.js";import{u as x}from"./Df9SUa8M.js";function p(e){return e.length>1&&e.slice(-1)==="/"?e.slice(0,-1):e}const D=()=>{const e=L(),o=E(),a=x(),t=y(),i=S(),s=k(()=>o.value!==null),f=C(A,()=>!1);async function h(){f.value||(f.value=!0,await u())}async function u(){o.value=await a(t.endpoints.user)}async function m(c){const n=l(),g=p(n.path);if(s.value){if(!t.redirectIfAuthenticated)throw new Error("User is already authenticated");if(t.redirect.onLogin===!1||t.redirect.onLogin===g)return;if(t.redirect.onLogin===void 0)throw new Error("`sanctum.redirect.onLogin` is not defined");await e.runWithContext(async()=>await r(t.redirect.onLogin))}if(t.endpoints.login===void 0)throw new Error("`sanctum.endpoints.login` is not defined");const w=await a(t.endpoints.login,{method:"post",body:c});if(t.mode==="token"){if(i.tokenStorage===void 0)throw new Error("`sanctum.tokenStorage` is not defined in app.config.ts");if(w.token===void 0)throw new Error("Token was not returned from the API");await i.tokenStorage.set(e,w.token)}if(await u(),t.redirect.keepRequestedRoute){const d=n.query.redirect;if(d&&d!==g){await e.runWithContext(async()=>await r(d));return}}if(!(t.redirect.onLogin===!1||n.path===t.redirect.onLogin)){if(t.redirect.onLogin===void 0)throw new Error("`sanctum.redirect.onLogin` is not defined");await e.runWithContext(async()=>await r(t.redirect.onLogin))}}async function v(){if(!s.value)throw new Error("User is not authenticated");const c=l(),n=p(c.path);if(t.endpoints.logout===void 0)throw new Error("`sanctum.endpoints.logout` is not defined");if(await a(t.endpoints.logout,{method:"post"}),o.value=null,t.mode==="token"){if(i.tokenStorage===void 0)throw new Error("`sanctum.tokenStorage` is not defined in app.config.ts");await i.tokenStorage.set(e,void 0)}if(!(t.redirect.onLogout===!1||n===t.redirect.onLogout)){if(t.redirect.onLogout===void 0)throw new Error("`sanctum.redirect.onLogout` is not defined");await e.runWithContext(async()=>await r(t.redirect.onLogout))}}return{user:o,isAuthenticated:s,init:h,login:m,logout:v,refreshIdentity:u}};export{p as t,D as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.