refactor: 不同用户登录及时清理历史菜单缓存 #5118

This commit is contained in:
Wangjiahao 2023-05-22 17:08:01 +08:00
parent 4ef0c28431
commit 6d7f5388e7

View File

@ -109,6 +109,13 @@ const actions = {
if (!data) {
reject('Verification failed, please Login again.')
}
const historyUserId = localStorage.getItem('userId')
if(historyUserId && historyUserId !== data.userId+''){
const clearLocalStorage = [ 'panel-main-tree', 'panel-default-tree','chart-tree','dataset-tree']
clearLocalStorage.forEach((item) => {
localStorage.removeItem(item)
})
}
localStorage.setItem('userId', data.userId)
const currentUser = data
commit('SET_USER', currentUser)