{"version":3,"file":"js/chunk.5764.7a40e236.js","mappings":"mLAEO,IAAMA,EAAyB,MAAO,CAAEC,QAAAA,CAAO,CAAE,IAEtD,IAAMC,EAAUC,IADAC,IAAIH,EAAQE,GAAG,EACXE,YAAY,CAC1BC,EAAQJ,EAAQK,GAAG,CAAC,SACpBC,EAAQN,EAAQK,GAAG,CAAC,SACpBE,EAAcP,EAAQK,GAAG,CAAC,gBAEhC,GAAI,CAACD,GAAS,CAACE,EACb,MAAOE,CAAAA,EAAAA,EAAAA,EAAAA,EAAS,QAGlB,IAAMC,EAAM,MAAMC,MAAM,uBAAwB,CAC9CC,OAAQ,OACRC,QAAS,CACP,eAAgB,kBAClB,EACAC,KAAMC,KAAKC,SAAS,CAAC,CAAEX,MAAAA,EAAOE,MAAAA,CAAM,EACtC,GAEA,GAAI,CAACG,EAAIO,EAAE,CAAE,CACX,IAAIC,EACJ,GAAI,CACF,GAAM,CAAEC,QAAAA,CAAO,CAAE,CAAG,MAAMT,EAAIU,IAAI,GAClCF,EAAQC,CACV,CAAE,MAAOE,EAAG,CACVH,EAAQ,gCACV,CACA,MAAOT,CAAAA,EAAAA,EAAAA,EAAAA,EAAS,CAAC,cAAc,EAAEa,mBAAmBJ,GAAO,CAAC,CAC9D,CAGA,OADAK,SAASC,IAAI,CAAGhB,GAAe,IACxB,IACT,EAEaiB,EAAY,IAEhB,I","sources":["webpack://@affine/web/../core/src/pages/magic-link.tsx"],"sourcesContent":["import { type LoaderFunction, redirect } from 'react-router-dom';\n\nexport const loader: LoaderFunction = async ({ request }) => {\n const url = new URL(request.url);\n const queries = url.searchParams;\n const email = queries.get('email');\n const token = queries.get('token');\n const redirectUri = queries.get('redirect_uri');\n\n if (!email || !token) {\n return redirect('/404');\n }\n\n const res = await fetch('/api/auth/magic-link', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ email, token }),\n });\n\n if (!res.ok) {\n let error: string;\n try {\n const { message } = await res.json();\n error = message;\n } catch (e) {\n error = 'failed to verify sign-in token';\n }\n return redirect(`/signIn?error=${encodeURIComponent(error)}`);\n }\n\n location.href = redirectUri || '/';\n return null;\n};\n\nexport const Component = () => {\n // TODO(@eyhn): loading ui\n return null;\n};\n"],"names":["loader","request","queries","url","URL","searchParams","email","get","token","redirectUri","redirect","res","fetch","method","headers","body","JSON","stringify","ok","error","message","json","e","encodeURIComponent","location","href","Component"],"sourceRoot":""}