Initial commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from 'vue'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const auth = useAuthStore()
|
||||
const router = useRouter()
|
||||
|
||||
onMounted(() => {
|
||||
if (!auth.token && router.currentRoute.value.meta.requiresAuth) {
|
||||
router.push('/login')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user