Last active
May 11, 2019 03:33
-
-
Save alexytiger/1c0ac6357662793b9043722adea4f470 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() | |
export class IpfsDaemonEffects { | |
constructor( | |
private ipfsSrv: IpfsDaemonService, | |
private readonly actions$: Actions | |
) {} | |
onConnectEffect$ = createEffect( | |
() => | |
this.actions$.pipe( | |
ofType(ROOT_EFFECTS_INIT), | |
switchMap(() => | |
this.ipfsSrv.getVersion().pipe( | |
tap(version => console.log(`IPFS node version: ${version}`)), | |
map(_ => IpfsDaemonActions.connectSuccess()), | |
catchError((err: Error) => | |
of(ErrorActions.errorMessage({ errorMsg: err.message })) | |
) | |
) | |
) | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment