Created
January 16, 2021 14:55
-
-
Save rafagsiqueira/52d82684a057ae3f8f0ef2bb8dc98f1e to your computer and use it in GitHub Desktop.
Asynchronous methods with multiple promises and RxJS
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
getUsers$ = (): Observable<any> => { | |
if (someCondition) { | |
return from(someAsyncOperation()) | |
} | |
else { | |
return from(someOtherAsyncOperation()) | |
} | |
} | |
getUsers2$ = (): Observable<any> => someCondition ? from(someAsyncOperation()) : from(someOtherAsyncOperation()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment