combine token stripping logic, use utils

This commit is contained in:
Michael Bradley, Jr 2018-10-24 14:43:23 -05:00
parent 53d6b9d704
commit a594b14f27
1 changed files with 5 additions and 9 deletions

View File

@ -27,7 +27,7 @@ class AppContainer extends Component {
return; return;
} }
const token = this.getQueryToken(); const token = getQueryToken(this.props.lcation);
if (!token) { if (!token) {
return; return;
@ -56,14 +56,10 @@ class AppContainer extends Component {
this.props.authenticate(this.props.credentials.host, this.props.credentials.token); this.props.authenticate(this.props.credentials.host, this.props.credentials.token);
} }
if (this.getQueryToken() && if (getQueryToken(this.props.location) &&
!this.props.credentials.authenticated && (!this.props.credentials.authenticating ||
!this.props.credentials.authenticating) { this.props.credentials.authenticated)) {
this.props.history.replace(this.stripQueryToken(this.props.location)); this.props.history.replace(stripQueryToken(this.props.location));
}
if (this.getQueryToken() && this.props.credentials.authenticated) {
this.props.history.replace(this.stripQueryToken(this.props.location));
} }
if (this.props.credentials.authenticated && !this.props.initialized) { if (this.props.credentials.authenticated && !this.props.initialized) {