Fix prompt redirect logic and db sync bug.

This commit is contained in:
Yang Luo
2021-06-20 13:27:26 +08:00
parent d3a8ab8347
commit a43db3e55a
8 changed files with 126 additions and 7 deletions

View File

@ -113,13 +113,31 @@ class SignupPage extends React.Component {
}
}
onUpdateAccount(account) {
this.props.onUpdateAccount(account);
}
onFinish(values) {
const application = this.getApplicationObj();
values.phonePrefix = application.organizationObj.phonePrefix;
AuthBackend.signup(values)
.then((res) => {
if (res.status === 'ok') {
Setting.goToLinkSoft(this, this.getResultPath(application));
AuthBackend.getAccount("")
.then((res) => {
let account = null;
if (res.status === "ok") {
account = res.data;
account.organization = res.data2;
this.onUpdateAccount(account);
Setting.goToLinkSoft(this, this.getResultPath(application));
} else {
if (res.msg !== "Please sign in first") {
Setting.showMessage("error", `Failed to sign in: ${res.msg}`);
}
}
});
} else {
Setting.showMessage("error", i18next.t(`signup:${res.msg}`));
}