mirror of
https://github.com/YunoHost/yunohost-portal.git
synced 2024-09-03 20:06:23 +02:00
13 lines
288 B
TypeScript
13 lines
288 B
TypeScript
|
import { useIsLoggedIn } from '@/composables/states'
|
||
|
|
||
|
export default defineNuxtRouteMiddleware((to, from) => {
|
||
|
const isLoggedIn = useIsLoggedIn()
|
||
|
|
||
|
if (to.name === 'login' && isLoggedIn.value) {
|
||
|
return navigateTo('/')
|
||
|
}
|
||
|
if (!isLoggedIn.value) {
|
||
|
navigateTo('/login')
|
||
|
}
|
||
|
})
|