Everything seemed to be working fine with my project. However, I noticed in the console network that one of my GET
requests is being sent twice even though I only triggered it once. View network console here
If I comment out the entire created
function code, the duplicate GET
request no longer appears in the console network. (see code snippet below)
I am curious to know what could be causing this issue and how to go about fixing it.
Below is the code for Component.vue:
<script>
export default {
created: async function() {
await this.$store.dispatch('file/all');
},
};
</script>
And here is the action from the vuex module post.js:
const actions = {
all({commit}, data) {
return axios.get(`files`)
.then(response => {
commit('setData', response);
});
},
}