Last active
May 13, 2018 08:06
-
-
Save jamestthompson3/78b4029c395f3277b0a6808dd153f96f to your computer and use it in GitHub Desktop.
This file contains 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
const load = mapPropsStream(props$ => | |
props$.pipe( | |
switchMap(props => | |
from(fetchUsers()).pipe( | |
tap(res => console.log('response from fetchUsers', res), | |
map(users => ({ ...props, users, status: 'SUCCESS' })), | |
startWith({ status: 'REQUEST' }) | |
) | |
), | |
catchError(() => ({ status: 'ERROR', message: 'Looks like our service is down' })) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment