Created
December 6, 2019 23:16
-
-
Save kmaraz/b03e361aefa627fc43debdccf6b355a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class ThingsEffects { | |
fetchThings$ = createEffect(() => this.actions$.pipe( | |
ofType(ThingsActions.fetchThings), | |
switchMap(() => this.api.things.fetch() | |
.pipe( | |
map((data) => ThingsActions.update(data.items)) | |
)) | |
)); | |
constructor( | |
private actions$: Actions<ThingsActions.All>, | |
private api: API | |
) { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment