修复bug

This commit is contained in:
yannqing 2024-01-23 21:32:36 +08:00
parent 18edad8c61
commit 0b6cfa9e77

View File

@ -34,11 +34,15 @@ const username=ref("John Doe")
const avatarUrl=ref("path_to_avatar")
const dropdownVisible=ref(false)
const token = window.localStorage.getItem("token")
import {useRouter} from "vue-router";
/**
* 配置
*/
const router = useRouter()
message.config({
background: true
})
@ -54,6 +58,12 @@ function logout() {
// 退
requests.logout(token).then((res)=>{
console.log(res)
if (res.data.code === 200) {
router.push("/login")
message.success("退出成功")
}else {
message.error(res.data.message)
}
})
}