Skip to content

Commit

Permalink
fix: ensure user cookies are cleared before logout redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Junjiequan committed Feb 14, 2025
1 parent a505802 commit 04da6d0
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions src/app/state-management/effects/user.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,25 +216,23 @@ export class UserEffects {
return this.actions$.pipe(
ofType(fromActions.logoutAction),
filter(() => this.authService.isAuthenticated()),
switchMap(() =>
this.sharedAuthService.authControllerLogout().pipe(
switchMap(({ logoutURL }) => {
this.authService.clear();
return [
clearDatasetsStateAction(),
clearInstrumentsStateAction(),
clearJobsStateAction(),
clearLogbooksStateAction(),
clearPoliciesStateAction(),
clearProposalsStateAction(),
clearPublishedDataStateAction(),
clearSamplesStateAction(),
fromActions.logoutCompleteAction({ logoutURL }),
];
}),
switchMap(() => {
this.authService.clear();
return this.sharedAuthService.authControllerLogout().pipe(
switchMap(({ logoutURL }) => [
clearDatasetsStateAction(),
clearInstrumentsStateAction(),
clearJobsStateAction(),
clearLogbooksStateAction(),
clearPoliciesStateAction(),
clearProposalsStateAction(),
clearPublishedDataStateAction(),
clearSamplesStateAction(),
fromActions.logoutCompleteAction({ logoutURL }),
]),
catchError(() => of(fromActions.logoutFailedAction())),
),
),
);
}),
);
});

Expand Down

0 comments on commit 04da6d0

Please sign in to comment.