refactor: add onMastoInit
This commit is contained in:
parent
6092b27da6
commit
6729666170
5 changed files with 15 additions and 22 deletions
|
@ -4,18 +4,10 @@ export default defineNuxtRouteMiddleware((to) => {
|
|||
if (to.path === '/signin/callback')
|
||||
return
|
||||
|
||||
if (!isMastoInitialised.value) {
|
||||
watchOnce(isMastoInitialised, () => {
|
||||
if (!currentUser.value)
|
||||
return navigateTo(`/${currentServer.value}/public`)
|
||||
if (to.path === '/')
|
||||
return navigateTo('/home')
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (!currentUser.value)
|
||||
return navigateTo(`/${currentServer.value}/public`)
|
||||
if (to.path === '/')
|
||||
return navigateTo('/home')
|
||||
onMastoInit(() => {
|
||||
if (!currentUser.value)
|
||||
return navigateTo(`/${currentServer.value}/public`)
|
||||
if (to.path === '/')
|
||||
return navigateTo('/home')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue