Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cbc504c

Browse files
author
piexlMax(奇淼
committedMay 19, 2025·
fix(用户模块): 修正清理存储逻辑以正确删除cookie和localStorage项
1 parent 99550cb commit cbc504c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎web/src/pinia/modules/user.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,12 @@ export const useUserStore = defineStore('user', () => {
128128
/* 清理数据 */
129129
const ClearStorage = async () => {
130130
token.value = ''
131-
xToken.value = ''
131+
// 使用remove方法正确删除cookie
132+
xToken.remove()
132133
sessionStorage.clear()
134+
// 清理所有相关的localStorage项
133135
localStorage.removeItem('originSetting')
136+
localStorage.removeItem('token')
134137
}
135138

136139
return {

0 commit comments

Comments
 (0)
Please sign in to comment.