feat(layout): 添加用户列表视图并优化登出逻辑

- 新增 UserListView 组件
- 在 DefaultLayout 中添加登出时清除 token 的逻辑
This commit is contained in:
LingandRX 2025-01-01 19:19:11 +08:00
parent d9f814ccfb
commit 5c1858d9e0
2 changed files with 13 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import { RouterView } from 'vue-router'
import { h, ref } from 'vue' import { h, ref } from 'vue'
import { AppstoreOutlined, MailOutlined } from '@ant-design/icons-vue' import { AppstoreOutlined, MailOutlined } from '@ant-design/icons-vue'
import router from '@/router/index.js' import router from '@/router/index.js'
import { removeToken } from '@/utils/auth.js'
const current = ref(['mail']) const current = ref(['mail'])
const items = ref([ const items = ref([
@ -38,6 +39,7 @@ const logout = async () => {
}) })
if (response.ok) { if (response.ok) {
removeToken()
await router.push('/login') await router.push('/login')
} else { } else {
console.error('Logout failed', response.statusText) console.error('Logout failed', response.statusText)

View File

@ -0,0 +1,11 @@
<script setup>
</script>
<template>
</template>
<style scoped>
</style>