18315: Fixes websocket init. 18315-collection-panel-refresh
authorLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 15 Feb 2022 21:55:33 +0000 (18:55 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 15 Feb 2022 21:55:33 +0000 (18:55 -0300)
When accessing WB2 using the '/token?api_token=xxx' URL, the websocket
service was being initialized with 'api_token=undefined'.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/index.tsx

index 0b04c29e4c896c5387688caeadb35cc29bafc43a..c160f96c2c9346be412757a149c5d45c7da78ec7 100644 (file)
@@ -183,7 +183,7 @@ const initListener = (history: History, store: RootStore, services: ServiceRepos
     let initialized = false;
     return async () => {
         const { router, auth } = store.getState();
-        if (router.location && auth.user && !initialized) {
+        if (router.location && auth.user && services.authService.getApiToken() && !initialized) {
             initialized = true;
             initWebSocket(config, services.authService, store);
             await store.dispatch(loadWorkbench());