0
我在我的反應REDX應用程序中使用提取API以及REDX傳奇流問題是我有同步調用訪存API。但是我的那個電話不會通過傳奇觸發。下面是我的第一個電話傳奇沒有觸發同步API調用
import {fetchAggregatedData1,
fetchAggregatedData2
} from '../actions/mixActions';
fetch(types.BASE_URL + types.DATA_URL).then(response => {
var res=response.json();
console.log('response',res)
const maxYear = Math.max.apply(
Math,
res.map(function(data) {
return data.year;
})
);
console.log('trigered in api')
fetchAggregatedData2(maxYear);
fetchAggregatedData1(maxYear);
return res;
下面是我的行動
export function fetchAggregatedData2(year) {
return {
type: types.FETCH_AGGREGATED2,
year
};
}
export function fetchAggregatedData1(year) {
return {
type: types.FETCH_AGGREGATED1,
year
};
}
這裏是我的傳奇index.js
export default function* startForman() {
yield [
fork(watchAggregate1),
fork(watchAggregate2)
]}
在watchAggregate1.js
export default function* watchAggregate1() {
yield takeLatest(types.FETCH_AGGREGATED1, aggregateSaga1);
}
任何人都可以讓我知道爲什麼同步呼叫不是經歷?