frontend: fix admin auth with redirects
Signed-off-by: Nicolas Froger <nicolas@kektus.xyz>
This commit is contained in:
parent
3da3b6491b
commit
4d7ab2ed8a
3 changed files with 42 additions and 18 deletions
|
|
@ -27,11 +27,16 @@ export const useAuthStore = defineStore("auth", () => {
|
|||
})
|
||||
}
|
||||
|
||||
const storedToken = localStorage.getItem("kektus-summer-admin-token")
|
||||
if (storedToken) {
|
||||
login(storedToken)
|
||||
function checkFromLocalStorage() {
|
||||
const storedToken = localStorage.getItem("kektus-summer-admin-token")
|
||||
if (storedToken) {
|
||||
return login(storedToken)
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
return { adminToken, login, isAuth, error }
|
||||
|
||||
return { adminToken, login, checkFromLocalStorage, isAuth, error }
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue