Make 'fetchdata' components in templates compatible with latest TypeScript compiler

This commit is contained in:
SteveSandersonMS
2016-11-29 19:10:48 +00:00
parent 28b8136fa6
commit 939e0aeee0
5 changed files with 9 additions and 9 deletions

View File

@@ -46,8 +46,8 @@ export const actionCreators = {
// Only load data if it's something we don't already have (and are not already loading)
if (startDateIndex !== getState().weatherForecasts.startDateIndex) {
let fetchTask = fetch(`/api/SampleData/WeatherForecasts?startDateIndex=${ startDateIndex }`)
.then(response => response.json())
.then((data: WeatherForecast[]) => {
.then(response => response.json() as Promise<WeatherForecast[]>)
.then(data => {
dispatch({ type: 'RECEIVE_WEATHER_FORECASTS', startDateIndex: startDateIndex, forecasts: data });
});