Merge pull request #5268 from dataease/pr@dev@refactor_refresh-menu

refactor: 不同用户登录及时清理历史菜单缓存 #5118
This commit is contained in:
王嘉豪
2023-05-22 17:10:49 +08:00
committed by GitHub

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)