refactor: use middleware to handle redirection
This commit is contained in:
parent
a17d3276d3
commit
0dac7b9785
3 changed files with 15 additions and 13 deletions
|
@ -1,12 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
const token = useCookie('nuxtodon-token')
|
||||
const router = useRouter()
|
||||
|
||||
// TODO: move to middleware
|
||||
if (!token.value)
|
||||
router.replace('/public')
|
||||
else
|
||||
router.replace('/home')
|
||||
definePageMeta({
|
||||
middleware: 'auth',
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue