mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
fix: don't redirect to login when no auth (#3165)
Co-authored-by: Piotr Markiewicz <piotr.markiewicz@vaimo.com>
This commit is contained in:
parent
bee71d93fe
commit
da5a6e051f
@ -1,7 +1,7 @@
|
|||||||
import { useAuthStore } from "@/stores/auth";
|
import { useAuthStore } from "@/stores/auth";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import { JwtPayload, jwtDecode } from "jwt-decode";
|
import { JwtPayload, jwtDecode } from "jwt-decode";
|
||||||
import { baseURL } from "./constants";
|
import { baseURL, noAuth } from "./constants";
|
||||||
import { StatusError } from "@/api/utils";
|
import { StatusError } from "@/api/utils";
|
||||||
|
|
||||||
export function parseToken(token: string) {
|
export function parseToken(token: string) {
|
||||||
@ -98,5 +98,9 @@ export function logout() {
|
|||||||
authStore.clearUser();
|
authStore.clearUser();
|
||||||
|
|
||||||
localStorage.setItem("jwt", "");
|
localStorage.setItem("jwt", "");
|
||||||
router.push({ path: "/login" });
|
if (noAuth) {
|
||||||
|
window.location.reload();
|
||||||
|
} else {
|
||||||
|
router.push({path: "/login"});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user