From 6d7f5388e757f1f950043daf3e3a9e1ac6b28acf Mon Sep 17 00:00:00 2001 From: Wangjiahao <1522128093@qq.com> Date: Mon, 22 May 2023 17:08:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=B8=8D=E5=90=8C=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=99=BB=E5=BD=95=E5=8F=8A=E6=97=B6=E6=B8=85=E7=90=86?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=8F=9C=E5=8D=95=E7=BC=93=E5=AD=98=20#5118?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/store/modules/user.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/store/modules/user.js b/frontend/src/store/modules/user.js index 91ca204667..efc51fd300 100644 --- a/frontend/src/store/modules/user.js +++ b/frontend/src/store/modules/user.js @@ -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)