From da5a6e051faa80134c2adf4e621426cbdf046c88 Mon Sep 17 00:00:00 2001 From: Piotr Markiewicz Date: Sun, 28 Apr 2024 20:00:42 +0200 Subject: [PATCH] fix: don't redirect to login when no auth (#3165) Co-authored-by: Piotr Markiewicz --- frontend/src/utils/auth.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/auth.ts b/frontend/src/utils/auth.ts index 5fe8ce31..e30f6556 100644 --- a/frontend/src/utils/auth.ts +++ b/frontend/src/utils/auth.ts @@ -1,7 +1,7 @@ import { useAuthStore } from "@/stores/auth"; import router from "@/router"; import { JwtPayload, jwtDecode } from "jwt-decode"; -import { baseURL } from "./constants"; +import { baseURL, noAuth } from "./constants"; import { StatusError } from "@/api/utils"; export function parseToken(token: string) { @@ -98,5 +98,9 @@ export function logout() { authStore.clearUser(); localStorage.setItem("jwt", ""); - router.push({ path: "/login" }); + if (noAuth) { + window.location.reload(); + } else { + router.push({path: "/login"}); + } }