removed hardcoded auth url from client

This commit is contained in:
2025-11-19 20:50:41 -05:00
parent 5adbfa520c
commit 8845024f76

View File

@@ -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
}