浏览代码

feat: 登录时重新拉去项目信息

lanjianrong 4 年之前
父节点
当前提交
c0d2de4ada
共有 1 个文件被更改,包括 8 次插入8 次删除
  1. 8 8
      src/store/mobx/user/index.ts

+ 8 - 8
src/store/mobx/user/index.ts

@@ -53,14 +53,14 @@ class UserState {
   @computed get menuBtnText() {
     return this.userInfo.name || this.userInfo.account
   }
-  @action login(values: iFromValues) {
-    apiLogin(values).then(({ code = -1, data }) => {
-      if (code === consts.RET_CODE.SUCCESS) {
-        saveUserInfo(data)
-        this.userInfo = data
-        history.push('/')
-      }
-    })
+  @action async login(values: iFromValues) {
+    const { code = -1, data } = await apiLogin(values)
+    if (code === consts.RET_CODE.SUCCESS) {
+      await this.getProjectInfo()
+      saveUserInfo(data)
+      this.userInfo = data
+      history.push('/')
+    }
   }
 
   @action updateUserInfo(values: any) {