Fix login

login().then(...) executes too early, we need to wait for SUCCESS.

Change-Id: I1b5b278dad7737a5369d1b6903d3e03c09e095a3
This commit is contained in:
Manuel Stahl 2019-07-26 21:28:44 +02:00
parent a6d5558d94
commit 00c59c9575

View File

@ -38,11 +38,8 @@ export class Login extends Component {
this.setState({ submitted: true });
const { homeserver, username, password } = this.state;
const { login } = this.props.actions;
const { history } = this.props;
if (homeserver && username && password) {
login(homeserver, username, password).then(
history.push("/user-admin/list")
);
login(homeserver, username, password);
}
}
@ -52,7 +49,7 @@ export class Login extends Component {
const { homeserver, username, password, submitted } = this.state;
return (
<div className="home-login">
{mtx && mtx.clientRunning &&
{mtx && mtx.clientRunning && mtx.credentials.userId && !loginPending &&
<Redirect to="/user-admin/list" />
}
<header className="app-header">