diff --git a/src/app.d.ts b/src/app.d.ts index 743f07b..bf2938e 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -3,11 +3,26 @@ declare global { namespace App { // interface Error {} - // interface Locals {} + interface Locals { + user: SessionUserInfo, + project: SessionProjectInfo + } // interface PageData {} // interface PageState {} // interface Platform {} } + + interface SessionUserInfo { + id: string, + username: string, + email: string, + account_type: string + } + + interface SessionProjectInfo { + id: string, + project_name: string + } } export {}; diff --git a/src/hooks.server.js b/src/hooks.server.js index 81f1a07..8da02f7 100644 --- a/src/hooks.server.js +++ b/src/hooks.server.js @@ -2,8 +2,9 @@ import { validateSession } from '$lib/services/auth.server'; /** @type {import('@sveltejs/kit').Handle} */ export async function handle({ event, resolve }) { + if(event.url.pathname === "/auth") return resolve(event); const session_id = event.cookies.get("token"); - if (session_id === undefined && event.url.pathname !== "/auth") return Response.redirect(event.url.host+"/auth", 303); + if (session_id === undefined) return Response.redirect(event.url.host+"/auth", 303); // @ts-ignore const user = await validateSession(session_id); diff --git a/src/lib/components/organisms/auth/login-form.svelte b/src/lib/components/organisms/auth/login-form.svelte new file mode 100644 index 0000000..5b53154 --- /dev/null +++ b/src/lib/components/organisms/auth/login-form.svelte @@ -0,0 +1,69 @@ + + + +