2022-12-04 22:56:33 +03:00
|
|
|
export default defineNuxtRouteMiddleware((to) => {
|
2022-12-17 19:55:29 +03:00
|
|
|
if (process.server)
|
|
|
|
return
|
2022-12-26 11:34:30 +03:00
|
|
|
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)
|
2022-12-04 23:05:11 +03:00
|
|
|
return navigateTo(`/${currentServer.value}/public`)
|
2022-12-04 22:56:33 +03:00
|
|
|
if (to.path === '/')
|
2022-11-15 16:54:13 +03:00
|
|
|
return navigateTo('/home')
|
|
|
|
})
|