15064: Fetch discovery documents for all remotes
[arvados-workbench2.git] / src / views-components / api-token / api-token.tsx
index 43c55a92c9addbd8031fd537b5c59528b620e7ca..b78e7192dc0bd24f5c1ef14ed1ab6c0629aea564 100644 (file)
@@ -16,6 +16,7 @@ import { initSessions } from "~/store/auth/auth-action-session";
 interface ApiTokenProps {
     authService: AuthService;
     config: Config;
+    loadMainApp: boolean;
 }
 
 export const ApiToken = connect()(
@@ -23,15 +24,18 @@ 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(() => {
-                this.props.dispatch(navigateToRootProject);
+                if (loadMainApp) {
+                    this.props.dispatch(navigateToRootProject);
+                }
             });
         }
         render() {
-            return <div/>;
+            return <div />;
         }
     }
 );