diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index ba05018..92c2da3 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -11,11 +11,15 @@ import type { LayoutLoad } from "./$types"; // See: https://v2.tauri.app/start/frontend/sveltekit/ for more info export const ssr = false; +function isGuardedPage(pathname: string) { + return !pathname.startsWith("/boot") && !pathname.startsWith("/settings") && !pathname.startsWith("/create"); +} + export const load: LayoutLoad = async ({url}) => { const currentOpenedDataset = get(openedDatasetDir); console.debug('[Main Load]', currentOpenedDataset, url); - if (isNil(currentOpenedDataset) && url.pathname !== "/boot" && url.pathname !== "/settings") { + if (isNil(currentOpenedDataset) && isGuardedPage(url.pathname)) { redirect(303, "/boot"); } }