|
|
@@ -23,7 +23,6 @@ export default {
|
|
|
setState({ userInfo });
|
|
|
},
|
|
|
getUserInfo() {
|
|
|
- setState({ initApp: false });
|
|
|
const { updateUser } = model();
|
|
|
const { httpGet } = model("httpModel");
|
|
|
const { changeVerfied } = model("verifiedModel");
|
|
|
@@ -77,17 +76,18 @@ export default {
|
|
|
loginByPassword(phone, password) {
|
|
|
const { httpPost, addAsyncStorage } = model("httpModel");
|
|
|
const { success, warnning } = model("loadingModel");
|
|
|
+ const { getUserInfo } = model();
|
|
|
|
|
|
return httpPost("/auth/login", {
|
|
|
username: phone,
|
|
|
password,
|
|
|
})
|
|
|
.then(res => {
|
|
|
- if (res) {
|
|
|
- addAsyncStorage("token", res);
|
|
|
- success("登录成功");
|
|
|
- setState({ initApp: true });
|
|
|
- }
|
|
|
+ success("登录成功");
|
|
|
+ return addAsyncStorage("token", res);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ return getUserInfo();
|
|
|
})
|
|
|
.catch(e => {
|
|
|
warnning(e.error);
|