login and auth

This commit is contained in:
hptangxi
2025-07-02 20:44:30 +08:00
parent 8e1de8d29f
commit 7b372de6d8
12 changed files with 113 additions and 87 deletions

View File

@@ -1,12 +1,18 @@
<script setup lang="ts">
import Layout from "@/components/Layout.vue";
import { useAuthKey } from "@/services/auth";
import { NDialogProvider, NMessageProvider } from "naive-ui";
import { computed } from "vue";
const authKey = useAuthKey();
const isLoggedIn = computed(() => !!authKey.value);
</script>
<template>
<n-message-provider>
<n-dialog-provider>
<layout />
<layout v-if="isLoggedIn" />
<router-view v-else />
</n-dialog-provider>
</n-message-provider>
</template>