X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/66fbf108bc45021a3187bb63f4c0672e4e6ad3c9..25216cc7acedc987c26a159f0b640210c0ef101e:/src/store/auth/auth-middleware.ts diff --git a/src/store/auth/auth-middleware.ts b/src/store/auth/auth-middleware.ts index 6eef5e5e..87a1253b 100644 --- a/src/store/auth/auth-middleware.ts +++ b/src/store/auth/auth-middleware.ts @@ -4,12 +4,12 @@ import { Middleware } from "redux"; import { authActions, } from "./auth-action"; -import { ServiceRepository, setAuthorizationHeader, removeAuthorizationHeader } from "~/services/services"; -import { initSessions } from "~/store/auth/auth-action-session"; -import { User } from "~/models/user"; -import { RootState } from '~/store/store'; -import { progressIndicatorActions } from "~/store/progress-indicator/progress-indicator-actions"; -import { WORKBENCH_LOADING_SCREEN } from '~/store/workbench/workbench-actions'; +import { ServiceRepository, setAuthorizationHeader, removeAuthorizationHeader } from "services/services"; +import { initSessions } from "store/auth/auth-action-session"; +import { User } from "models/user"; +import { RootState } from 'store/store'; +import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions"; +import { WORKBENCH_LOADING_SCREEN } from 'store/workbench/workbench-actions'; export const authMiddleware = (services: ServiceRepository): Middleware => store => next => action => { // Middleware to update external state (local storage, window @@ -44,7 +44,7 @@ export const authMiddleware = (services: ServiceRepository): Middleware => store // want to either add support for displaying/signing user // agreements or get rid of self-activation. // For more details, see: - // https://doc.arvados.org/master/admin/user-management.html + // https://doc.arvados.org/main/admin/user-management.html store.dispatch(progressIndicatorActions.START_WORKING(WORKBENCH_LOADING_SCREEN)); services.userService.activate(user.uuid).then((user: User) => { @@ -64,11 +64,12 @@ export const authMiddleware = (services: ServiceRepository): Middleware => store if (deleteLinkData) { services.linkAccountService.removeAccountToLink(); } + const token = services.authService.getApiToken(); services.authService.removeApiToken(); services.authService.removeSessions(); services.authService.removeUser(); removeAuthorizationHeader(services); - services.authService.logout(); + services.authService.logout(token || ''); }, default: () => next(action) });