浏览代码

调整验证状态

黄琪勇 1 年之前
父节点
当前提交
1a78db2a1f
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7 7
      src/store/modules/user.ts

+ 7 - 7
src/store/modules/user.ts

@@ -39,6 +39,13 @@ const useStore = defineStore("user", {
       /** 获取用户信息 */
       async getUserInfo(): Promise<menuType[]> {
          const userType = getUserType()
+         if (!userType) {
+            return Promise.reject({
+               code: "500",
+               data: null,
+               message: "获取用户信息出错!"
+            })
+         }
          // GYM 和 GYT 区分 code验证错误码的区分
          userType !== "GYM" || setCODE401(5000)
          // GYM 和 GYT 区分 获取用户信息的接口区分
@@ -46,13 +53,6 @@ const useStore = defineStore("user", {
          if (userInfoRes.code !== 200) {
             return Promise.reject(userInfoRes)
          }
-         if (!userType) {
-            return Promise.reject({
-               code: "500",
-               data: null,
-               message: "获取用户信息出错,请联系管理员!"
-            })
-         }
          // GYM 和 GYT 区分 用户信息数据不一样区分
          this.userInfo = handleUserInfo(userType, userInfoRes.data)
          this.roles = userType as any