feat(layout): 添加用户列表视图并优化登出逻辑
- 新增 UserListView 组件 - 在 DefaultLayout 中添加登出时清除 token 的逻辑
This commit is contained in:
parent
d9f814ccfb
commit
5c1858d9e0
@ -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)
|
||||||
|
|||||||
11
src/views/UserListView.vue
Normal file
11
src/views/UserListView.vue
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<script setup>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user