【发布时间】:2016-06-18 18:38:30
【问题描述】:
我正在使用带有 es6 的 react 和 Flux 实用程序。我希望SalesStore 在执行自己的调度之前等待SessionStore 完成。在SalesStore 我有以下内容,但调度不等待。有谁知道问题可能是什么?谢谢。
class SalesStore extends ReduceStore {
getInitialState() {
return {};
}
reduce(state, action) {
switch(action.type) {
case Constants.FETCH_SALES:
this.getDispatcher().waitFor([SessionStore.getDispatchToken()]);
return state;
case Constants.FETCH_SALES_SUCCESS:
this.getDispatcher().waitFor([SessionStore.getDispatchToken()]);
return action.payload;
case Constants.FETCH_SALES_FAILURE:
this.getDispatcher().waitFor([SessionStore.getDispatchToken()]);
return state;
default:
return state;
}
}
}
export default new SalesStore(AppDispatcher);
【问题讨论】:
标签: reactjs flux reactjs-flux