1
0

Support for loading, deleting, tag joining, and

This commit is contained in:
2020-04-10 17:40:02 -04:00
parent ebae5a5801
commit a55c555138
28 changed files with 484 additions and 9 deletions

View File

@@ -0,0 +1,30 @@
import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { map, switchMap, catchError } from 'rxjs/operators';
import { CommentService } from './comment.service';
import * as CommentActions from './comment.actions';
@Injectable()
export class CommentEffects {
loadComments$ = createEffect(() =>
this.actions$.pipe(
ofType(CommentActions.loadComments),
switchMap(_ =>
this.api.getAll().pipe(
map(data => CommentActions.loadCommentsSuccess({ comments: data as any })), // debug type issue here
catchError(_ => of(CommentActions.loadCommentsFailure()))
)
)
)
);
constructor(
private api: CommentService,
private actions$: Actions
) { }
}