Skip to content

Commit c9c9a0e

Browse files
wesleygrimesbrandonroberts
authored andcommitted
feat(example): update ofType in effects per #1676 (#1691)
Closes #1676
1 parent 45a5781 commit c9c9a0e

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

projects/example-app/src/app/auth/effects/auth.effects.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { LogoutConfirmationDialogComponent } from '@example-app/auth/components/
1717
export class AuthEffects {
1818
login$ = createEffect(() =>
1919
this.actions$.pipe(
20-
ofType(LoginPageActions.login.type),
20+
ofType(LoginPageActions.login),
2121
map(action => action.credentials),
2222
exhaustMap((auth: Credentials) =>
2323
this.authService.login(auth).pipe(
@@ -31,7 +31,7 @@ export class AuthEffects {
3131
loginSuccess$ = createEffect(
3232
() =>
3333
this.actions$.pipe(
34-
ofType(AuthApiActions.loginSuccess.type),
34+
ofType(AuthApiActions.loginSuccess),
3535
tap(() => this.router.navigate(['/']))
3636
),
3737
{ dispatch: false }
@@ -40,7 +40,7 @@ export class AuthEffects {
4040
loginRedirect$ = createEffect(
4141
() =>
4242
this.actions$.pipe(
43-
ofType(AuthApiActions.loginRedirect.type, AuthActions.logout.type),
43+
ofType(AuthApiActions.loginRedirect, AuthActions.logout),
4444
tap(authed => {
4545
this.router.navigate(['/login']);
4646
})
@@ -50,7 +50,7 @@ export class AuthEffects {
5050

5151
logoutConfirmation$ = createEffect(() =>
5252
this.actions$.pipe(
53-
ofType(AuthActions.logoutConfirmation.type),
53+
ofType(AuthActions.logoutConfirmation),
5454
exhaustMap(() => {
5555
const dialogRef = this.dialog.open<
5656
LogoutConfirmationDialogComponent,
@@ -70,7 +70,7 @@ export class AuthEffects {
7070
);
7171

7272
constructor(
73-
private actions$: Actions<LoginPageActions.LoginPageActionsUnion>,
73+
private actions$: Actions,
7474
private authService: AuthService,
7575
private router: Router,
7676
private dialog: MatDialog

projects/example-app/src/app/books/effects/book.effects.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ export class BookEffects {
3333
search$ = createEffect(
3434
() => ({ debounce = 300, scheduler = asyncScheduler } = {}) =>
3535
this.actions$.pipe(
36-
ofType(FindBookPageActions.searchBooks.type),
36+
ofType(FindBookPageActions.searchBooks),
3737
debounceTime(debounce, scheduler),
3838
switchMap(({ query }) => {
3939
if (query === '') {
4040
return empty;
4141
}
4242

4343
const nextSearch$ = this.actions$.pipe(
44-
ofType(FindBookPageActions.searchBooks.type),
44+
ofType(FindBookPageActions.searchBooks),
4545
skip(1)
4646
);
4747

@@ -57,7 +57,7 @@ export class BookEffects {
5757
);
5858

5959
constructor(
60-
private actions$: Actions<FindBookPageActions.FindBookPageActionsUnion>,
60+
private actions$: Actions,
6161
private googleBooks: GoogleBooksService
6262
) {}
6363
}

projects/example-app/src/app/books/effects/collection.effects.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class CollectionEffects {
2626

2727
loadCollection$ = createEffect(() =>
2828
this.actions$.pipe(
29-
ofType(CollectionPageActions.loadCollection.type),
29+
ofType(CollectionPageActions.loadCollection),
3030
switchMap(() =>
3131
this.storageService.getCollection().pipe(
3232
map((books: Book[]) =>
@@ -42,7 +42,7 @@ export class CollectionEffects {
4242

4343
addBookToCollection$ = createEffect(() =>
4444
this.actions$.pipe(
45-
ofType(SelectedBookPageActions.addBook.type),
45+
ofType(SelectedBookPageActions.addBook),
4646
mergeMap(({ book }) =>
4747
this.storageService.addToCollection([book]).pipe(
4848
map(() => CollectionApiActions.addBookSuccess({ book })),
@@ -54,7 +54,7 @@ export class CollectionEffects {
5454

5555
removeBookFromCollection$ = createEffect(() =>
5656
this.actions$.pipe(
57-
ofType(SelectedBookPageActions.removeBook.type),
57+
ofType(SelectedBookPageActions.removeBook),
5858
mergeMap(({ book }) =>
5959
this.storageService.removeFromCollection([book.id]).pipe(
6060
map(() => CollectionApiActions.removeBookSuccess({ book })),
@@ -65,9 +65,7 @@ export class CollectionEffects {
6565
);
6666

6767
constructor(
68-
private actions$: Actions<
69-
SelectedBookPageActions.SelectedBookPageActionsUnion
70-
>,
68+
private actions$: Actions,
7169
private storageService: BookStorageService
7270
) {}
7371
}

0 commit comments

Comments
 (0)