|
@@ -145,10 +145,9 @@ export const AuthProvider: React.FC<PropsWithChildren> = ({ children }) => {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onSuccess: async () => {
|
|
onSuccess: async () => {
|
|
|
- // 先清除用户状态
|
|
|
|
|
- queryClient.setQueryData(['currentUser'], null)
|
|
|
|
|
|
|
+ // 清空所有 React Query 缓存,避免重新登录后显示旧数据
|
|
|
|
|
+ queryClient.clear()
|
|
|
// 使用 reLaunch 关闭所有页面并跳转到登录页
|
|
// 使用 reLaunch 关闭所有页面并跳转到登录页
|
|
|
- // 添加延迟确保状态更新完成
|
|
|
|
|
await new Promise(resolve => setTimeout(resolve, 100))
|
|
await new Promise(resolve => setTimeout(resolve, 100))
|
|
|
Taro.reLaunch({ url: '/pages/login/index' })
|
|
Taro.reLaunch({ url: '/pages/login/index' })
|
|
|
},
|
|
},
|