Im sure this has been asked before but i cant for the life of me figure out whats going on
this code in the page
fetch ({ store }) {
const response = await axios.get(dataUrl);
console.log(response.data)
store.commit("SET_SECTIONS", response.data);
}
and yet somehow this doesn't work
fetch ({store}) {
store.dispatch('fetchSections')
}
where in the store the action is doing the same thing
async fetchSections({ commit, getters }) {
const response = await axios.get(dataUrl);
console.log(response.data)
commit("SET_SECTIONS", response.data);
}
the console log is the same for both, but for some reason the one where the fetc calls the action isnt populating the store?
Any ideas?
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c903">#c903</a>)</em></sub></div>