Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

fix: redirect issues for authorized users (#374)

Hayden8c57ff841ec7
diff --git a/frontend/composables/use-auth-context.ts b/frontend/composables/use-auth-context.ts
index c39ac3fd..bcffad77 100644
--- a/frontend/composables/use-auth-context.ts
+++ b/frontend/composables/use-auth-context.ts
@@ -106,8 +106,8 @@ class AuthContext implements IAuthContext {
this._expiresAt.value = null;
this._attachmentToken.value = null;
- navigateTo("/");
console.log("Session invalidated");
+ window.location.href = "/";
}
async login(api: PublicApi, email: string, password: string, stayLoggedIn: boolean) {
diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts
index c98f1a11..479d1f46 100644
--- a/frontend/nuxt.config.ts
+++ b/frontend/nuxt.config.ts
@@ -20,7 +20,7 @@ export default defineNuxtConfig({
},
devOptions: {
// Enable to troubleshoot during development
- enabled: true,
+ enabled: false,
},
manifest: {
name: "Homebox",
diff --git a/frontend/pages/index.vue b/frontend/pages/index.vue
index 614a826c..2258c4cd 100644
--- a/frontend/pages/index.vue
+++ b/frontend/pages/index.vue
@@ -8,6 +8,9 @@
});
const ctx = useAuthContext();
+ if (ctx.isAuthorized()) {
+ navigateTo("/home");
+ }
const api = usePublicApi();
const toast = useNotifier();
@@ -29,10 +32,6 @@
}
});
- if (!ctx.isAuthorized()) {
- navigateTo("/home");
- }
-
const route = useRoute();
const router = useRouter();