PageSourceSearch

https://www.bikely.com/assets/ClaimInvite-DdoKiNwr.js

js bikely.com collected 2026-10-02 09:59:23 UTC 3,141 bytes, 1 lines download raw bytes

1import{u as f,l as v,m as k,r as c,i as m,k as C,j as e,c as u,B as l,C as N}from"./index-DTL302P6.js";import{C as w,a as S,b,c as I,d as A}from"./card-Bn2w8S0a.js";import{S as T}from"./shield-check-C3F8H05G.js";import{C as y}from"./circle-x-BIMHX8dk.js";function L(){const{t:a}=f(),[h]=v(),r=k(),o=h.get("token"),[n,t]=c.useState("loading"),[g,i]=c.useState("");c.useEffect(()=>{x()},[o]);const x=async()=>{if(!o){t("error"),i(a("portal.auth.admin.noInviteToken","No invite token provided"));return}const{data:{session:s}}=await m.auth.getSession();if(!s){t("not-authenticated");return}await p()},p=async()=>{t("claiming");try{const{data:s,error:d}=await m.rpc("claim_admin_invite",{invite_token:o});if(d){t("error"),i(d.message);return}s===!0?(t("success"),C.success(a("portal.auth.admin.adminAccessGranted","Du har nå admin-tilgang!"))):(t("error"),i(a("portal.auth.admin.invalidOrExpiredInvite","Ugyldig eller utløpt invitasjonslenke")))}catch(s){t("error"),i(s.message||a("portal.auth.admin.failedToClaimInvite","Kunne ikke hente invitasjonen"))}},j=()=>{sessionStorage.setItem("redirectAfterLogin",window.location.href),r("/auth")};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs(w,{className:"w-full max-w-md",children:[e.jsxs(S,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-4",children:e.jsx(T,{className:"h-12 w-12 text-primary"})}),e.jsx(b,{children:a("portal.auth.admin.inviteTitle","Admin-invitasjon")}),e.jsx(I,{children:a("portal.auth.admin.inviteSubtitle","Du er invitert til å bli admin")})]}),e.jsxs(A,{className:"flex flex-col items-center gap-4",children:[n==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx(u,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground",children:a("portal.auth.admin.checkingInvite","Sjekker invitasjon...")})]}),n==="not-authenticated"&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-center text-muted-foreground",children:a("portal.auth.admin.signInToAccept","Vennligst logg inn eller opprett en konto for å hente admin-tilgangen.")}),e.jsx(l,{onClick:j,className:"w-full",children:a("portal.auth.admin.signInSignUp","Logg inn / Registrer deg")})]}),n==="claiming"&&e.jsxs(e.Fragment,{children:[e.jsx(u,{className:"h-8 w-8 animate-spin text-primary"}),e.jsx("p",{className:"text-muted-foreground",children:a("portal.auth.admin.grantingAccess","Gir admin-tilgang...")})]}),n==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"h-12 w-12 text-green-500"}),e.jsx("p",{className:"text-center font-medium",children:a("portal.auth.admin.adminAccessGranted","Du har nå admin-tilgang!")}),e.jsx(l,{onClick:()=>r("/dashboard"),className:"w-full",children:a("portal.auth.admin.goToDashboard","Gå til dashbord")})]}),n==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"h-12 w-12 text-destructive"}),e.jsx("p",{className:"text-center text-destructive font-medium",children:g}),e.jsx(l,{variant:"outline",onClick:()=>r("/"),className:"w-full",children:a("portal.auth.admin.goHome","Gå til forsiden")})]})]})]})})}export{L as default};

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.