Last active
April 8, 2021 10:29
-
-
Save aqrojo/9c4d0f207efb71191cc55eb3b3274338 to your computer and use it in GitHub Desktop.
mobx-introduction_03_observables
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
// dentro del observable Manager... | |
// promesa | |
fetchTemperatures() { | |
axios.get(...) | |
.then( | |
thermometerList.onFetchSuccess, | |
thermometerList.onFetchError, | |
) | |
} | |
// async / await | |
async fetchTemperatures() { | |
const temperatures = axios.get(...) | |
try { | |
thermometerList.onFetchSuccess(temperatures) | |
}catch(e) { | |
thermometerList.onFetchError() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ejemplo de acciones asíncronas que ejecutan otras acciones al resolver una promesa