From a95e89e8f1095b08424432d38cd5133030a323e2 Mon Sep 17 00:00:00 2001 From: EETagent Date: Sat, 3 Dec 2022 16:41:56 +0100 Subject: [PATCH] feat: return to register if details not set --- .../(authenticated)/dashboard/+layout.server.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 frontend/src/routes/(candidate)/(authenticated)/dashboard/+layout.server.ts diff --git a/frontend/src/routes/(candidate)/(authenticated)/dashboard/+layout.server.ts b/frontend/src/routes/(candidate)/(authenticated)/dashboard/+layout.server.ts new file mode 100644 index 0000000..400f787 --- /dev/null +++ b/frontend/src/routes/(candidate)/(authenticated)/dashboard/+layout.server.ts @@ -0,0 +1,11 @@ +import { apiFetchDetails } from '$lib/@api/candidate'; +import { redirect } from '@sveltejs/kit'; +import type { LayoutServerLoad } from './$types'; + +export const load: LayoutServerLoad = async ({ fetch }) => { + const details = await apiFetchDetails(fetch); + + if (details === null) { + throw redirect(302, '/register'); + } +};