Skip to content

Instantly share code, notes, and snippets.

@klemola
Last active May 16, 2019 10:34
Show Gist options
  • Save klemola/7514247da88a09c99760d6170c7a8f68 to your computer and use it in GitHub Desktop.
Save klemola/7514247da88a09c99760d6170c7a8f68 to your computer and use it in GitHub Desktop.
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