Last active
May 16, 2019 10:34
-
-
Save klemola/7514247da88a09c99760d6170c7a8f68 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
interface User { | |
username: string; | |
email: string; | |
} | |
type Translations = { [key: string]: string }; | |
export function main() { | |
let userRequest: RemoteData<User, Error> = Loading; | |
let translationsRequest: RemoteData<Translations, Error> = Loading; | |
fetchUser() | |
.then(response => { | |
userRequest = Success(response); | |
}) | |
.catch(error => { | |
userRequest = Failure(error); | |
}); | |
fetchTranslations() | |
.then(response => { | |
translationsRequest = Success(response); | |
}) | |
.catch(error => { | |
translationsRequest = Failure(error); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment