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