forked from Ivasoft/geovisio-website
test
This commit is contained in:
@@ -50,18 +50,23 @@ router.beforeEach(async (to, from, next) => {
|
||||
to.name === 'my-settings' ||
|
||||
to.name === 'my-sequences' ||
|
||||
to.name === 'sequence'
|
||||
const nextRoute = `${location.protocol}//${location.host}${to.path}`
|
||||
if (loggedRoutes) {
|
||||
try {
|
||||
const loginUrl = `/api/users/me`
|
||||
const isKeycloakLogout = await axios.get(loginUrl)
|
||||
const isSiteLogin = !!cookies.get('user_id')
|
||||
if (isKeycloakLogout.status >= 300 || !isSiteLogin) {
|
||||
const win: Window = window
|
||||
win.location = getAuthRoute('/auth/login', to.path)
|
||||
} else next()
|
||||
await router.push(
|
||||
`api/auth/login?next_url=${encodeURIComponent(nextRoute)}`
|
||||
)
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
} catch (e) {
|
||||
const win: Window = window
|
||||
win.location.href = getAuthRoute('/auth/login', to.path)
|
||||
await router.push(
|
||||
`api/auth/login?next_url=${encodeURIComponent(nextRoute)}`
|
||||
)
|
||||
}
|
||||
} else next()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user