Files
SmartUp/frontend/src/App.vue
T
2026-05-12 17:51:53 +08:00

19 lines
369 B
Vue

<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>