I'm trying to make something work with my vue app
I made constants.js file in which i just declare some of URLs I plan to recycle instead of rewriting them every time, but some of them require IDs of stuff
#Example of constant definined in constants.js
export const useVariables = `https://myapiserver.com/iNeedVar1Here/${var1}/iNeedVar2here/${var2}`
And now I want to use this constant in my vue app and pass the variables where I need them, before sending the actual request
getItem() {
let var2 = this.formValues.item2;
let var1 = this.formValues.item1;
if (item != null) {
axios.get(useVariables)
.then((res) => {
console.log(res.data)
})
.catch(err => console.log(err));
}
else {
alert('Select an item before preceding')
}
var2 & var1 is used before its declare, which is illegal for const variables