diff options
author | Linnnus <[email protected]> | 2025-02-17 20:28:59 +0100 |
---|---|---|
committer | Linnnus <[email protected]> | 2025-02-17 20:28:59 +0100 |
commit | 2b309097ca145651618234476160fb30405eabe7 (patch) | |
tree | 20321cf83d18c0c3c3a0a745626565074ea69a41 /app/src/routes/profile/+page.server.ts |
Initial commit
Diffstat (limited to 'app/src/routes/profile/+page.server.ts')
-rw-r--r-- | app/src/routes/profile/+page.server.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/src/routes/profile/+page.server.ts b/app/src/routes/profile/+page.server.ts new file mode 100644 index 0000000..5c9b9d3 --- /dev/null +++ b/app/src/routes/profile/+page.server.ts @@ -0,0 +1,10 @@ +import type { PageServerLoad } from "./$types"; +import { redirect } from "@sveltejs/kit"; + +export const load = (async ({ url, locals }) => { + if (!locals.user) { + redirect(303, `/login?redirectTo=${encodeURIComponent(url.toString())}`); + } + + return { user: locals.user }; +}) satisfies PageServerLoad; |