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[] = [];
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue