fix: 修复web、h5同时打开token失效问题

This commit is contained in:
zhuoqinglian
2026-03-10 16:15:09 +08:00
parent ff1076deac
commit d86387971a
2 changed files with 41 additions and 37 deletions
+2 -1
View File
@@ -51,10 +51,11 @@ export const useUserStore = defineStore(
*/
const getUserInfo = async () => {
const userData = await _getUserInfo()
const authInfo = JSON.parse(uni.getStorageSync('token') || '{}')
const userInfoWithExtras = {
...userData,
avatar: userInfoState.avatar,
token: uni.getStorageSync('token') || '',
token: authInfo.token || '',
}
setUserInfo(userInfoWithExtras)
uni.setStorageSync('userInfo', userInfoWithExtras)