Set document title on navigation to url path, refs #19369
[arvados-workbench2.git] / src / store / auth / auth-middleware.ts
index 9535ca2d99ce40a94702ca0e47786910369ba843..0d08405ae11e87f329553e236e4550c0720a6fd6 100644 (file)
@@ -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
@@ -56,10 +56,10 @@ export const authMiddleware = (services: ServiceRepository): Middleware => store
             }
         },
         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();
@@ -69,7 +69,7 @@ export const authMiddleware = (services: ServiceRepository): Middleware => store
             services.authService.removeSessions();
             services.authService.removeUser();
             removeAuthorizationHeader(services);
-            services.authService.logout(token || '');
+            services.authService.logout(token || '', preservePath);
         },
         default: () => next(action)
     });