Update templates to domain-task 2.0.0. Fixes #166.

This commit is contained in:
SteveSandersonMS
2016-07-11 11:55:01 +01:00
parent fc897475f3
commit 58bf117442
9 changed files with 19 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
import { fetch } from 'domain-task/fetch';
import { fetch, addTask } from 'domain-task';
import { typeName, isActionType, Action, Reducer } from 'redux-typed';
import { ActionCreator } from './';
@@ -45,12 +45,13 @@ export const actionCreators = {
requestWeatherForecasts: (startDateIndex: number): ActionCreator => (dispatch, getState) => {
// Only load data if it's something we don't already have (and are not already loading)
if (startDateIndex !== getState().weatherForecasts.startDateIndex) {
fetch(`/api/SampleData/WeatherForecasts?startDateIndex=${ startDateIndex }`)
let fetchTask = fetch(`/api/SampleData/WeatherForecasts?startDateIndex=${ startDateIndex }`)
.then(response => response.json())
.then((data: WeatherForecast[]) => {
dispatch(new ReceiveWeatherForecasts(startDateIndex, data));
});
addTask(fetchTask); // Ensure server-side prerendering waits for this to complete
dispatch(new RequestWeatherForecasts(startDateIndex));
}
}

View File

@@ -23,7 +23,7 @@
"aspnet-prerendering": "^1.0.2",
"aspnet-webpack": "^1.0.2",
"babel-core": "^6.5.2",
"domain-task": "^1.0.0",
"domain-task": "^2.0.0",
"react": "^15.0.1",
"react-dom": "^15.0.1",
"react-redux": "^4.4.4",