Merge branch '16679-token-security-enhancements'
[arvados-workbench2.git] / src / index.tsx
index d07d3c9e025d870077445af3e79a0078c589a763..0a51ed3c8ab94c9fab61d80325f429428ea098d2 100644 (file)
@@ -14,7 +14,7 @@ import { configureStore, RootStore } from '~/store/store';
 import { ConnectedRouter } from "react-router-redux";
 import { ApiToken } from "~/views-components/api-token/api-token";
 import { AddSession } from "~/views-components/add-session/add-session";
-import { initAuth } from "~/store/auth/auth-action";
+import { initAuth, logout } from "~/store/auth/auth-action";
 import { createServices } from "~/services/services";
 import { MuiThemeProvider } from '@material-ui/core/styles';
 import { CustomTheme } from '~/common/custom-theme';
@@ -108,8 +108,10 @@ fetchConfig()
                 if (showSnackBar) {
                     console.error("Backend error:", error);
 
-                    if (error.errors[0].indexOf("not found") > -1) {
+                    if (error.status === 404) {
                         store.dispatch(openNotFoundDialog());
+                    } else if (error.status === 401 && error.errors[0].indexOf("Not logged in") > -1) {
+                        store.dispatch(logout());
                     } else {
                         store.dispatch(snackbarActions.OPEN_SNACKBAR({
                             message: `${error.errors