export const authActions = unionize({
LOGIN: {},
- LOGOUT: {},
+ LOGOUT: ofType<{ deleteLinkData: boolean }>(),
CONFIG: ofType<{ config: Config }>(),
INIT: ofType<{ user: User, token: string }>(),
USER_DETAILS_REQUEST: {},
};
export const logout = (deleteLinkData: boolean = false) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- if (deleteLinkData) {
- services.linkAccountService.removeAccountToLink();
- }
- services.authService.removeApiToken();
- services.authService.removeUser();
- removeAuthorizationHeader(services);
- services.authService.logout();
- dispatch(authActions.LOGOUT());
+ dispatch(authActions.LOGOUT({ deleteLinkData }));
};
export type AuthAction = UnionOf<typeof authActions>;
document.title = `Arvados Workbench (${config.uuidPrefix})`;
next(action);
},
+ LOGOUT: ({deleteLinkData}) => {
+ next(action)
+ if (deleteLinkData) {
+ services.linkAccountService.removeAccountToLink();
+ }
+ services.authService.removeApiToken();
+ services.authService.removeUser();
+ removeAuthorizationHeader(services);
+ services.authService.logout();
+ },
default: () => next(action)
});
};