removed hardcoded auth url from client
This commit is contained in:
@@ -37,6 +37,9 @@ const router = createRouter({
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const addr = import.meta.env.VITE_APIHOST;
|
||||||
|
|
||||||
|
|
||||||
router.beforeEach(async (to) => {
|
router.beforeEach(async (to) => {
|
||||||
const user = useUserStore()
|
const user = useUserStore()
|
||||||
|
|
||||||
@@ -49,7 +52,7 @@ router.beforeEach(async (to) => {
|
|||||||
if (to.meta.requiresAuth && !user.isLoggedIn) {
|
if (to.meta.requiresAuth && !user.isLoggedIn) {
|
||||||
// Redirect back to original page after login
|
// Redirect back to original page after login
|
||||||
const redirectUrl = encodeURIComponent(window.location.origin + to.fullPath)
|
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
|
return false // Prevent Vue Router from continuing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user