Last active
June 7, 2019 01:45
-
-
Save alexytiger/5bf33bfbb29be653de9dbafa89fe3da9 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
uploadFile$ = createEffect( | |
() => | |
this.actions$.pipe( | |
ofType(IpfsUploadActions.upload_image), | |
map(action => action.file), | |
exhaustMap((file) => { | |
return this.ipfsSrv.addFile(file).pipe( | |
tap(ipfsHash => console.log(`IPFS file hash: ${ipfsHash}`)), | |
map(ipfsHash => IpfsUploadActions.upload_image_success({ipfsHash})), | |
catchError((err: Error) => | |
of(ErrorActions.errorMessage({ errorMsg: err.message }), IpfsUploadActions.upload_image_fail) | |
) | |
) | |
}) | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment