diff --git a/src/routes/(main)/login/+page.server.ts b/src/routes/(main)/login/+page.server.ts index f8ebd72..f900f9a 100644 --- a/src/routes/(main)/login/+page.server.ts +++ b/src/routes/(main)/login/+page.server.ts @@ -2,12 +2,6 @@ import { redirect } from "@sveltejs/kit" import type { Actions, PageServerLoad } from "./$types" import { error } from "@sveltejs/kit" -export const load: PageServerLoad = async ({ locals }) => { - return { - user: locals.user, - } -} - export const actions: Actions = { login: async (event) => { const data = await event.request.formData() diff --git a/src/routes/(main)/register/+page.server.ts b/src/routes/(main)/register/+page.server.ts index 5f5b626..4d1568a 100644 --- a/src/routes/(main)/register/+page.server.ts +++ b/src/routes/(main)/register/+page.server.ts @@ -1,12 +1,6 @@ import { redirect } from "@sveltejs/kit" import type { Actions, PageServerLoad } from "./$types" -export const load: PageServerLoad = async ({ locals }) => { - return { - user: locals.user, - } -} - export const actions: Actions = { register: async (event) => { const data = await event.request.formData(); diff --git a/src/routes/(main)/settings/+page.server.ts b/src/routes/(main)/settings/+page.server.ts index 7127e0a..5bb072b 100644 --- a/src/routes/(main)/settings/+page.server.ts +++ b/src/routes/(main)/settings/+page.server.ts @@ -2,10 +2,9 @@ import { redirect } from "@sveltejs/kit" import type { Actions, PageServerLoad } from "./$types" import { error } from "@sveltejs/kit" -export const load: PageServerLoad = async ({ locals }) => { - return { - user: locals.user, - } +export const load: PageServerLoad = async ({ cookies }) => { + const user = await authenticateUser(cookies) + return {user} } export const actions: Actions = {