fix: don't redirect to login when no auth (#3165)

Co-authored-by: Piotr Markiewicz <piotr.markiewicz@vaimo.com>
This commit is contained in:
Piotr Markiewicz 2024-04-28 20:00:42 +02:00 committed by GitHub
parent bee71d93fe
commit da5a6e051f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -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"});
}
}