Merge branch 'master' into 15088-merge-account
[arvados-workbench2.git] / src / views-components / api-token / api-token.tsx
index b0fd03134c613fff4a3be001fd88cd8c02d5e73c..2f8d87e1ede0d1b95fe688738583605136254904 100644 (file)
@@ -17,6 +17,7 @@ import { getAccountLinkData } from "~/store/link-account-panel/link-account-pane
 interface ApiTokenProps {
     authService: AuthService;
     config: Config;
+    loadMainApp: boolean;
 }
 
 export const ApiToken = connect()(
@@ -24,20 +25,23 @@ export const ApiToken = connect()(
         componentDidMount() {
             const search = this.props.location ? this.props.location.search : "";
             const apiToken = getUrlParameter(search, 'api_token');
+            const loadMainApp = this.props.loadMainApp;
             this.props.dispatch(saveApiToken(apiToken));
             this.props.dispatch<any>(getUserDetails()).then((user: User) => {
                 this.props.dispatch(initSessions(this.props.authService, this.props.config, user));
             }).finally(() => {
+                if (loadMainApp) {
                 if (this.props.dispatch(getAccountLinkData())) {
                     this.props.dispatch(navigateToLinkAccount);
                 }
                 else {
                     this.props.dispatch(navigateToRootProject);
                 }
+                }
             });
         }
         render() {
-            return <div/>;
+            return <div />;
         }
     }
 );