I have a method that makes two API calls and saves the results in separate variables. I need to access these variables from another method to manipulate the data.
What is the best way to access data from another method in Vue?
Below is the code for my API call:
async apiCall () {
const [result1, result2] =
await Promise.all([
get('lots/inputsOutputs', { locationId: '56464589a6d3b', fromDate: moment(this.dateRange[0]).format('YYYY-MM-DD'), toDate: moment(this.dateRange[1]).format('YYYY-MM-DD') }),
get('lots/inputsOutputs', { locationId: '5464564563ebd', fromDate: moment(this.dateRange[0]).format('YYYY-MM-DD'), toDate: moment(this.dateRange[1]).format('YYYY-MM-DD') })
]);
this.Loading = false;
return [result1, result2];
}