| | |
| | | .then((res) => { |
| | | if (res) { |
| | | console.log('res: ', res); |
| | | this.loginSuccess(res); |
| | | |
| | | resolve(); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | reject(error); |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | async twoFactorLoginSms(params: API.TwoFactorLoginSmsInput) { |
| | | try { |
| | | let res = await accountServices.twoFactorLoginSms(params, { showLoading: false }); |
| | | if (res) { |
| | | this.loginSuccess(res); |
| | | } |
| | | } catch (error) {} |
| | | }, |
| | | |
| | | loginSuccess(res: API.IdentityModelToken) { |
| | | this.setToken(res.accessToken); |
| | | |
| | | const accountInfo = getAccountInfoFromAccessToken(res.accessToken); |
| | |
| | | |
| | | // 获取用户信息 |
| | | this.setUserInfo(res); |
| | | |
| | | resolve(); |
| | | } |
| | | }) |
| | | .catch((error) => { |
| | | reject(error); |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 登出 清空缓存 |