19715: Preserve current url when api returns auth error
[arvados-workbench2.git] / src / index.tsx
index c214228258fd7945a44438346718f4937180f334..244d1387307778de1f0c4ccd01412bdc85797ccd 100644 (file)
@@ -132,7 +132,8 @@ fetchConfig()
                     if (error.status === 404) {
                         store.dispatch(openNotFoundDialog());
                     } else if (error.status === 401 && error.errors[0].indexOf("Not logged in") > -1) {
-                        store.dispatch(logout());
+                        // Catch auth errors when navigating and redirect to login preserving url location
+                        store.dispatch(logout(false, true));
                     } else {
                         store.dispatch(snackbarActions.OPEN_SNACKBAR({
                             message: `${error.errors