Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup unused logout store action #3987

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 2 additions & 22 deletions projects/aca-content/src/lib/store/effects/app.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
import { AppActionTypes, LogoutAction, ReloadDocumentListAction, ResetSelectionAction } from '@alfresco/aca-shared/store';
import { AuthenticationService } from '@alfresco/adf-core';
import { Router } from '@angular/router';
import { AppActionTypes, ReloadDocumentListAction, ResetSelectionAction } from '@alfresco/aca-shared/store';
import { AppHookService } from '@alfresco/aca-shared';

@Injectable()
export class AppEffects {
constructor(private actions$: Actions, private auth: AuthenticationService, private router: Router, private appHookService: AppHookService) {}
constructor(private actions$: Actions, private appHookService: AppHookService) {}

reload = createEffect(
() =>
Expand All @@ -55,22 +53,4 @@ export class AppEffects {
),
{ dispatch: false }
);

logout$ = createEffect(
() =>
this.actions$.pipe(
ofType<LogoutAction>(AppActionTypes.Logout),
map(() => {
this.auth.logout().subscribe(
() => this.redirectToLogin(),
() => this.redirectToLogin()
);
})
),
{ dispatch: false }
);

private redirectToLogin(): Promise<boolean> {
return this.router.navigate(['login']);
}
}
2 changes: 0 additions & 2 deletions projects/aca-shared/store/src/actions/app-action-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ export enum AppActionTypes {
SetUserProfile = 'SET_USER_PROFILE',
SetRepositoryInfo = 'SET_REPOSITORY_INFO',
ToggleInfoDrawer = 'TOGGLE_INFO_DRAWER',
Logout = 'LOGOUT',
ReloadDocumentList = 'RELOAD_DOCUMENT_LIST',
ResetSelection = 'RESET_SELECTION',
SetInfoDrawerState = 'SET_INFO_DRAWER_STATE',
SetInfoDrawerMetadataAspect = 'SET_INFO_DRAWER_METADATA_ASPECT',
CloseModalDialogs = 'CLOSE_MODAL_DIALOGS',
SetFileUploadingDialog = 'SET_FILE_UPLOADING_DIALOG',
ShowInfoDrawerPreview = 'SHOW_INFO_DRAWER_PREVIEW',
SetInfoDrawerPreviewState = 'SET_INFO_DRAWER_PREVIEW_STATE',
Expand Down
4 changes: 0 additions & 4 deletions projects/aca-shared/store/src/actions/app.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ export class ToggleInfoDrawerAction implements Action {
readonly type = AppActionTypes.ToggleInfoDrawer;
}

export class LogoutAction implements Action {
readonly type = AppActionTypes.Logout;
}

export class ReloadDocumentListAction implements Action {
readonly type = AppActionTypes.ReloadDocumentList;

Expand Down
Loading