feat: add log statements + remove auto redirect (#671)

Former-commit-id: 3ee150e7d66d18c6369d171994932744a614a74f
This commit is contained in:
Hayden 2023-12-15 21:32:44 -06:00 committed by GitHub
parent 1cc9bf459a
commit d759fad40c
3 changed files with 3 additions and 3 deletions

View file

@ -4,6 +4,7 @@ export default defineNuxtRouteMiddleware(async () => {
if (!ctx.isAuthorized()) {
if (window.location.pathname !== "/") {
console.debug("[middleware/auth] isAuthorized returned false, redirecting to /");
return navigateTo("/");
}
}
@ -13,6 +14,7 @@ export default defineNuxtRouteMiddleware(async () => {
const { data, error } = await api.user.self();
if (error) {
if (window.location.pathname !== "/") {
console.debug("[middleware/user] user is null and fetch failed, redirecting to /");
return navigateTo("/");
}
}