X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/61e9b81814696ee7cb9b0245e292a7e5dc691667..ecd0b3c069eed7d411e3cec7d707b43ab6675081:/src/index.tsx diff --git a/src/index.tsx b/src/index.tsx index 1a58dad1..0a51ed3c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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'; @@ -62,6 +62,7 @@ import { collectionAdminActionSet } from '~/views-components/context-menu/action import { processResourceAdminActionSet } from '~/views-components/context-menu/action-sets/process-resource-admin-action-set'; import { projectAdminActionSet } from '~/views-components/context-menu/action-sets/project-admin-action-set'; import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions"; +import { openNotFoundDialog } from './store/not-found-panel/not-found-panel-action'; console.log(`Starting arvados [${getBuildInfo()}]`); @@ -106,13 +107,20 @@ fetchConfig() errorFn: (id, error, showSnackBar) => { if (showSnackBar) { console.error("Backend error:", error); - store.dispatch(snackbarActions.OPEN_SNACKBAR({ - message: `${error.errors - ? error.errors[0] - : error.message}`, - kind: SnackbarKind.ERROR, - hideDuration: 8000}) - ); + + 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 + ? error.errors[0] + : error.message}`, + kind: SnackbarKind.ERROR, + hideDuration: 8000}) + ); + } } } });