X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/e0cb98c44ed8f32f269d2b9f878184263cd14192..37ebbbd4f05f811582546823738619f1fbb97686:/src/index.tsx

diff --git a/src/index.tsx b/src/index.tsx
index 21ecdab1..10224967 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -17,28 +17,36 @@ import { authService } from "./services/services";
 import { getProjectList } from "./store/project/project-action";
 import { MuiThemeProvider } from '@material-ui/core/styles';
 import { CustomTheme } from './common/custom-theme';
+import { fetchConfig } from './common/config';
+import { setBaseUrl } from './common/api/server-api';
+
+fetchConfig()
+    .then(config => {
+
+        setBaseUrl(config.API_HOST);
+
+        const history = createBrowserHistory();
+        const store = configureStore(history);
+
+        store.dispatch(authActions.INIT());
+        store.dispatch<any>(getProjectList(authService.getUuid()));
+
+        const App = () =>
+            <MuiThemeProvider theme={CustomTheme}>
+                <Provider store={store}>
+                    <ConnectedRouter history={history}>
+                        <div>
+                            <Route path="/" component={Workbench} />
+                            <Route path="/token" component={ApiToken} />
+                        </div>
+                    </ConnectedRouter>
+                </Provider>
+            </MuiThemeProvider>;
+
+        ReactDOM.render(
+            <App />,
+            document.getElementById('root') as HTMLElement
+        );
+    });
+
 
-const history = createBrowserHistory();
-
-const store = configureStore(history);
-
-store.dispatch(authActions.INIT());
-const rootUuid = authService.getRootUuid();
-store.dispatch<any>(getProjectList(rootUuid));
-
-const App = () =>
-    <MuiThemeProvider theme={CustomTheme}>
-        <Provider store={store}>
-            <ConnectedRouter history={history}>
-                <div>
-                    <Route path="/" component={Workbench}/>
-                    <Route path="/token" component={ApiToken}/>
-                </div>
-            </ConnectedRouter>
-        </Provider>
-    </MuiThemeProvider>;
-
-ReactDOM.render(
-    <App/>,
-    document.getElementById('root') as HTMLElement
-);
