Last active
January 18, 2020 04:40
-
-
Save alexytiger/fccb55db42c60c25e9d31826d95e6463 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
uploadImage$ = createEffect( | |
() => | |
this.actions$.pipe( | |
ofType(IpfsImageActions.uploadImage), | |
map(action => action.file), | |
exhaustMap((file) => { | |
return this.ipfsSrv.addFile(file).pipe( | |
tap(ipfsHash => console.log(`IPFS file hash: ${ipfsHash}`)), | |
map(ipfsHash => IpfsImageActions.uploadImageSuccess({ ipfsHash })), | |
catchError((err: Error) => | |
of(this.handleError(err), IpfsImageActions.uploadImageFail()) | |
) | |
); | |
}) | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment