I have following piece of code and cannot seem to access the mixin data/variable loading from mixin method. What am I doing wrong here?
Vue.mixin({
data: function () {
return {
loading: false,
};
},
methods: {
getEntityList: async (entityName) => {
loading = true
return await axios
.get("/api/" + entityName)
.then((response) => {
loading = false;
return response.data;
});
},
},
});
In Vue component, I am calling this function like:
export default {
name: "somename",
data() {
return {
accounts: [],
};
},
mounted() {
this.getEntityList('account').then(e => this.accounts = e);
},
};