Minor simplifications to Vue fetchdata logic
This commit is contained in:
parent
5e752169d6
commit
5d7e31d16f
|
|
@ -13,13 +13,7 @@ export default class FetchDataComponent extends Vue {
|
||||||
forecasts: WeatherForecast[] = [];
|
forecasts: WeatherForecast[] = [];
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
try {
|
const response = await fetch('api/SampleData/WeatherForecasts');
|
||||||
let response = await fetch('api/SampleData/WeatherForecasts');
|
this.forecasts = await response.json();
|
||||||
let data = await response.json();
|
|
||||||
this.forecasts = data;
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue