From 579a493ddb5601ff54846801633e5a54a0217012 Mon Sep 17 00:00:00 2001 From: florimondmanca Date: Wed, 31 Aug 2022 18:32:52 +0200 Subject: [PATCH] Fix redirect loop on home page --- client/src/constants.ts | 2 ++ client/src/lib/auth/guard.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/constants.ts b/client/src/constants.ts index e0f38425..ebcb66e3 100644 --- a/client/src/constants.ts +++ b/client/src/constants.ts @@ -6,6 +6,8 @@ export const STATIC_PAGES = [ "/auth/datapass/login", ]; +export const NON_AUTH_GUARDED_PAGES = [...STATIC_PAGES, "/"]; + export const DATA_FORMAT_LABELS: { [K in DataFormat]: string } = { file_tabular: "Fichier tabulaire (XLS, XLSX, CSV, ...)", file_gis: "Fichier SIG (Shapefile, ...)", diff --git a/client/src/lib/auth/guard.ts b/client/src/lib/auth/guard.ts index 3ecd7256..8cd25b5a 100644 --- a/client/src/lib/auth/guard.ts +++ b/client/src/lib/auth/guard.ts @@ -1,7 +1,7 @@ import { get } from "svelte/store"; import type { LoadOutput } from "@sveltejs/kit"; import { user } from "../stores/auth"; -import { STATIC_PAGES } from "src/constants"; +import { NON_AUTH_GUARDED_PAGES } from "src/constants"; import { Maybe } from "$lib/util/maybe"; /** @@ -9,7 +9,7 @@ import { Maybe } from "$lib/util/maybe"; * is attempting to access a protected page. */ export const authGuard = (url: URL): LoadOutput => { - if (STATIC_PAGES.includes(url.pathname)) { + if (NON_AUTH_GUARDED_PAGES.includes(url.pathname)) { return {}; }