diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts new file mode 100644 index 0000000..130eab6 --- /dev/null +++ b/src/routes/+layout.server.ts @@ -0,0 +1,16 @@ +import { redirect } from "@sveltejs/kit"; +import type { LayoutServerLoad } from "./$types"; + +export const load: LayoutServerLoad = async ({ url, fetch, cookies }) => { + if (url.pathname == "/login") { + return + } + console.log("what?") + const response = await fetch("https://api.fin.qowevisa.click/api/authping"); + + if (!response.ok) { + cookies.delete('session', { path: "/" }) + + throw redirect(302, "/login"); + } +}