From 1641d39ca71403bbeb3fd4816e667c820685f633 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 23 May 2025 17:59:17 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AD=98=E5=82=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 6c91aa5..2cb056d 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -7,6 +7,10 @@ import router from '@/router' import Layout from '@/layout' import ParentView from '@/components/ParentView' +const setState = (state) => { + localStorage.setItem('store', JSON.stringify(state)) +} + const getDefaultState = () => { const storeData = localStorage.getItem('store') let store = null @@ -127,6 +131,7 @@ const actions = { const { data } = response commit('SET_SHARE_TOKEN', data) commit('SET_SHARE_ID', shareId) + setState(state) resolve() }).catch(error => { reject(error) @@ -139,7 +144,7 @@ const actions = { commit('SET_NETDISK_NAME', netdiskName) commit('SET_NETDISK_LOGO', netdiskLogo) setLogo(netdiskName, netdiskLogo) - localStorage.setItem('store', JSON.stringify(state)) + setState(state) }, // get user info @@ -171,7 +176,7 @@ const actions = { commit('SET_NEW_VERSION', '') } setLogo(netdiskName, netdiskLogo) - localStorage.setItem('store', JSON.stringify(state)) + setState(state) resolve(data) }).catch(error => { reject(error)