【发布时间】:2018-06-19 21:55:52
【问题描述】:
我正在使用 Axios、Mobx/Mobx 状态树 (MST) 和 Reactjs 编写我的第一个 ajax 调用。
在 MST 中,他们有一种叫做流的东西,基本上与 async/await 做同样的事情
getCustomers: flow(function * (){
const response = yield getEnv(self).axiosInstance.get("/Customers/Get");
if(response.status === 200){
// response.data
} else {
// error though not sure what the call is? response.error?
}
}),
就这么简单吗?这是我应该如何检查状态是错误还是状态是否正常?
【问题讨论】:
标签: reactjs async-await axios mobx-state-tree