Skip to content

Instantly share code, notes, and snippets.

@alexytiger
Last active January 18, 2020 04:42
Show Gist options
  • Save alexytiger/80de47a2a22b15c45021e55e7f135890 to your computer and use it in GitHub Desktop.
Save alexytiger/80de47a2a22b15c45021e55e7f135890 to your computer and use it in GitHub Desktop.
e-book
downloadImage$ = createEffect(
() =>
this.actions$.pipe(
ofType(IpfsImageActions.downloadImage),
map((action) => action.ipfsHash),
switchMap((ipfsHash: string) =>
this.ipfsSrv.getFile(ipfsHash).pipe(
map((image: Blob) => IpfsImageActions.downloadImageSuccess({ image })),
catchError((err: Error) =>
of(this.handleError(err), IpfsImageActions.downloadImageError())
)
)
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment