diff --git a/ui/src/router/index.js b/ui/src/router/index.js index b688592..84d7189 100644 --- a/ui/src/router/index.js +++ b/ui/src/router/index.js @@ -37,6 +37,9 @@ const router = createRouter({ ] }) +const addr = import.meta.env.VITE_APIHOST; + + router.beforeEach(async (to) => { const user = useUserStore() @@ -49,7 +52,7 @@ router.beforeEach(async (to) => { if (to.meta.requiresAuth && !user.isLoggedIn) { // Redirect back to original page after login const redirectUrl = encodeURIComponent(window.location.origin + to.fullPath) - window.location.href = `https://aj17thdevapi.nexuszone.net/login?redirect=${redirectUrl}` + window.location.href = `${addr}/login?redirect=${redirectUrl}` return false // Prevent Vue Router from continuing }