mirror of
https://github.com/elk-zone/elk.git
synced 2024-12-18 09:01:46 +03:00
fix: sign-out and empty content (#1654)
This commit is contained in:
parent
6e7ac24821
commit
f7a8d471a6
1 changed files with 17 additions and 10 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import type { RouteLocationNormalized } from 'vue-router'
|
||||||
|
|
||||||
export default defineNuxtRouteMiddleware((to) => {
|
export default defineNuxtRouteMiddleware((to) => {
|
||||||
if (process.server)
|
if (process.server)
|
||||||
return
|
return
|
||||||
|
@ -5,7 +7,13 @@ export default defineNuxtRouteMiddleware((to) => {
|
||||||
if (to.path === '/signin/callback')
|
if (to.path === '/signin/callback')
|
||||||
return
|
return
|
||||||
|
|
||||||
onHydrated(() => {
|
if (isHydrated.value)
|
||||||
|
return handleAuth(to)
|
||||||
|
|
||||||
|
onHydrated(() => handleAuth(to))
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleAuth(to: RouteLocationNormalized) {
|
||||||
if (!currentUser.value) {
|
if (!currentUser.value) {
|
||||||
if (to.path === '/home' && to.query['share-target'] !== undefined)
|
if (to.path === '/home' && to.query['share-target'] !== undefined)
|
||||||
return navigateTo('/share-target')
|
return navigateTo('/share-target')
|
||||||
|
@ -14,5 +22,4 @@ export default defineNuxtRouteMiddleware((to) => {
|
||||||
}
|
}
|
||||||
if (to.path === '/')
|
if (to.path === '/')
|
||||||
return navigateTo('/home')
|
return navigateTo('/home')
|
||||||
})
|
}
|
||||||
})
|
|
||||||
|
|
Loading…
Reference in a new issue