Selaa lähdekoodia

docs: 更改路径为正式环境v1.3

chenpeng 1 viikko sitten
vanhempi
commit
f433ae0fb1
1 muutettua tiedostoa jossa 7 lisäystä ja 2 poistoa
  1. 7 2
      stores/modules/user.ts

+ 7 - 2
stores/modules/user.ts

@@ -23,6 +23,10 @@ export const useUserStore = defineStore(
     const isCompletedInfo = computed(() => {
       return !!(+userInfo.value?.infoState)
     })
+    const updateAccount = (data: any) => {
+      const commonStore = useCommonStore()
+      commonStore.pushAccount({ email: data.email, name: `${data.firstName} ${data.lastName}`, type: data.type })
+    }
 
     /** 登录操作 */
     const login = async (params: LoginRequestData) => {
@@ -36,8 +40,7 @@ export const useUserStore = defineStore(
           type: 'success',
           plain: true,
         })
-        const commonStore = useCommonStore()
-        commonStore.pushAccount({ email: userDataInfo.email, name: `${userDataInfo.firstName} ${userDataInfo.lastName}`, type: params.type })
+        updateAccount(userInfo.value)
       }
       catch (error) {
         return Promise.reject(error)
@@ -45,7 +48,9 @@ export const useUserStore = defineStore(
     }
     const updateUserInfo = (data: any) => {
       userInfo.value = { ...userInfo.value, ...data }
+      updateAccount(userInfo.value)
     }
+
     /** 退出登录操作 */
     const logout = async () => {
       try {