Skip to content

Commit

Permalink
fix: 修复用户退出登录,删除本地缓存问题 (#98)
Browse files Browse the repository at this point in the history
Co-authored-by: Evan <skcy@vip.qq.com>
  • Loading branch information
Kkuil and Evansy committed Sep 24, 2023
1 parent a84209c commit f208db9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/stores/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export const useUserStore = defineStore('user', () => {
.then((data) => {
userInfo.value = { ...userInfo.value, ...data }
})
.catch(()=> {
// 删除缓存
localStorage.removeItem("TOKEN")
localStorage.removeItem("USER_INFO")
})
}

return { userInfo, isSign, getUserDetailAction }
Expand Down
3 changes: 1 addition & 2 deletions src/views/Home/components/ToolBar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const menuList = [

<template>
<aside class="side-toolbar">
<Avatar :src="avatar" :size="isPc ? 50 : 40" v-login="showSettingBox" />
<Avatar :src="userStore.isSign ? avatar : ''" :size="isPc ? 50 : 40" v-login="showSettingBox" />
<div class="tool-icons">
<!-- 会话 -->
<router-link exactActiveClass="tool-icon-active" to="/">
Expand All @@ -88,7 +88,6 @@ const menuList = [
</el-badge>
</router-link>
</div>

<div class="menu">
<el-tooltip effect="dark" :placement="isPc ? 'right' : 'bottom'">
<template #content>
Expand Down

0 comments on commit f208db9

Please sign in to comment.