mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
wait before redirecting
This commit is contained in:
parent
e7482990aa
commit
d6992fe734
2 changed files with 10 additions and 6 deletions
|
@ -63,9 +63,9 @@ class LoginComplete extends React.Component {
|
|||
}
|
||||
}
|
||||
|
||||
componentDidUnmount() {
|
||||
stopTimer() {
|
||||
console.log("component unmounting");
|
||||
//clearInterval(this.timer);
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
|
||||
startTimer() {
|
||||
|
@ -93,13 +93,15 @@ class LoginComplete extends React.Component {
|
|||
if (this.state.currentUser && this.state.currentUser !== "") {
|
||||
console.log("user:");
|
||||
console.log(this.state.currentUser);
|
||||
this.stopTimer();
|
||||
return (<Redirect to="/home" />);
|
||||
}
|
||||
else if (this.state.secondsToWait > 0) {
|
||||
return (<p>Authenticating.. {this.state.secondsToWait}</p>);
|
||||
} else { // authenticating failed
|
||||
//NotificationsFactory.LOAD_ERROR('Backend did not return user after external auth');
|
||||
else if (this.state.secondsToWait == 0) {
|
||||
this.stopTimer();
|
||||
return (<Redirect to="/login" />);
|
||||
} else { // authenticating failed
|
||||
//NotificationsFactory.LOAD_ERROR('Backend did not return user after external auth');
|
||||
return (<p>Authenticating.. {this.state.secondsToWait}</p>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,8 @@ class LoginStore extends ReduceStore {
|
|||
console.log(action);
|
||||
localStorage.setItem('token', action.token);
|
||||
localStorage.setItem('currentUser', JSON.stringify(action.currentUser));
|
||||
console.log(localStorage.getItem('token'));
|
||||
console.log(localStorage.getItem("currentUser"));
|
||||
|
||||
return Object.assign({}, state, { token: action.token, currentUser: action.currentUser});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue