使用async/await
和.then().catch()
一起使用是否有任何危害,例如:
async apiCall(params) {
var results = await this.anotherCall()
.then(results => {
//do any results transformations
return results;
})
.catch(error => {
//handle any errors here
});
return results;
}
Run Code Online (Sandbox Code Playgroud)