0
我正在使用react和flux utils,使用es6。我希望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);