I want to use a Const variable that is inside a function and define it as a new const.
setup() {
async function recieveData() {
const result = await fetch(`${import.meta.env.VITE_APP_API_URL}/invoice`, {
method: "GET",
});
const array = await result.json();
}
}
I need to somehow get the const 'arrayData' from the function
setup() {
async function recieveData() {
const result = await fetch(`${import.meta.env.VITE_APP_API_URL}/invoice`, {
method: "GET",
});
const arrayData = await result.json();
}
//Adding the Variable here potentially like
const invoiceData = [];
invoiceData = arrayData;
}