From a594b14f27b541d82be2753824abdcf3e8d25a1d Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Wed, 24 Oct 2018 14:43:23 -0500 Subject: [PATCH] combine token stripping logic, use utils --- embark-ui/src/containers/AppContainer.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/embark-ui/src/containers/AppContainer.js b/embark-ui/src/containers/AppContainer.js index e325cc2a..cdd01c6f 100644 --- a/embark-ui/src/containers/AppContainer.js +++ b/embark-ui/src/containers/AppContainer.js @@ -27,7 +27,7 @@ class AppContainer extends Component { return; } - const token = this.getQueryToken(); + const token = getQueryToken(this.props.lcation); if (!token) { return; @@ -56,14 +56,10 @@ class AppContainer extends Component { this.props.authenticate(this.props.credentials.host, this.props.credentials.token); } - if (this.getQueryToken() && - !this.props.credentials.authenticated && - !this.props.credentials.authenticating) { - this.props.history.replace(this.stripQueryToken(this.props.location)); - } - - if (this.getQueryToken() && this.props.credentials.authenticated) { - this.props.history.replace(this.stripQueryToken(this.props.location)); + if (getQueryToken(this.props.location) && + (!this.props.credentials.authenticating || + this.props.credentials.authenticated)) { + this.props.history.replace(stripQueryToken(this.props.location)); } if (this.props.credentials.authenticated && !this.props.initialized) {