Minor simplifications to Vue fetchdata logic

This commit is contained in:
Steve Sanderson 2017-11-24 10:07:49 +00:00
parent 5e752169d6
commit 5d7e31d16f
1 changed files with 2 additions and 8 deletions

View File

@ -13,13 +13,7 @@ export default class FetchDataComponent extends Vue {
forecasts: WeatherForecast[] = [];
async mounted() {
try {
let response = await fetch('api/SampleData/WeatherForecasts');
let data = await response.json();
this.forecasts = data;
}
catch (err) {
console.log(err);
}
const response = await fetch('api/SampleData/WeatherForecasts');
this.forecasts = await response.json();
}
}