4👍
You can just extract your loading logic into a method that can be called from multiple locations:
const Comp = {
methods: {
fetchData() {
axios.get(....).then(response => {
this.dataset = response.data;
});
},
onSomeOtherAction() {
// Do stuff.
this.fetchData();
},
},
mounted() {
this.fetchData();
},
}
- [Vuejs]-Getting an internal server error when I try to make a request to a Seneca.js API using Axios
Source:stackexchange.com