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
// 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) => {
}
},
SET_CONFIG: ({ config }) => {
- document.title = `Arvados Workbench (${config.uuidPrefix})`;
+ document.title = `Arvados (${config.uuidPrefix})`;
next(action);
},
- LOGOUT: ({ deleteLinkData }) => {
+ LOGOUT: ({ deleteLinkData, preservePath }) => {
next(action);
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 || '', preservePath);
},
default: () => next(action)
});