Use env as redirect URL
This commit is contained in:
parent
7fbac1aaea
commit
f529e74f30
|
|
@ -3,6 +3,8 @@ import * as log from "loglevel";
|
|||
import { itGet, itPost } from "@/fetchHelpers";
|
||||
import { useAppStore } from "@/stores/app";
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
const logoutRedirectUrl = import.meta.env.VITE_LOGOUT_REDIRECT;
|
||||
// typed state https://stackoverflow.com/questions/71012513/when-using-pinia-and-typescript-how-do-you-use-an-action-to-set-the-state
|
||||
|
||||
export type UserState = {
|
||||
|
|
@ -53,7 +55,15 @@ export const useUserStore = defineStore({
|
|||
handleLogout() {
|
||||
itPost("/api/core/logout/", {}).then((data) => {
|
||||
Object.assign(this, initialUserState);
|
||||
window.location.href = "/";
|
||||
|
||||
let redirectUrl;
|
||||
|
||||
if (logoutRedirectUrl !== "") {
|
||||
redirectUrl = logoutRedirectUrl;
|
||||
} else {
|
||||
redirectUrl = "/";
|
||||
}
|
||||
window.location.href = redirectUrl;
|
||||
});
|
||||
},
|
||||
fetchUser() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue