Skip to content

Instantly share code, notes, and snippets.

@alexytiger
Last active February 19, 2020 00:39
Show Gist options
  • Save alexytiger/9b88f2c81dc212a555dbc7d604ab37ac to your computer and use it in GitHub Desktop.
Save alexytiger/9b88f2c81dc212a555dbc7d604ab37ac 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