Skip to content

Instantly share code, notes, and snippets.

@aqrojo
Last active April 8, 2021 10:29
Show Gist options
  • Save aqrojo/9c4d0f207efb71191cc55eb3b3274338 to your computer and use it in GitHub Desktop.
Save aqrojo/9c4d0f207efb71191cc55eb3b3274338 to your computer and use it in GitHub Desktop.
mobx-introduction_03_observables
// 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()
}
}
@aqrojo
Copy link
Author

aqrojo commented Apr 7, 2021

Ejemplo de acciones asíncronas que ejecutan otras acciones al resolver una promesa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment