Hello, am learning nuxt js to build server driven apps and so on, am in a point that i want to dispatch 2 actions to get data from 2 different sources, I don't know how to explain this the right way since am still learning here is my code hope it will make better to understand
async fetch({ store }) {
return await store.dispatch('featuredOnlinegames', 'latestNews')
},
computed: {
...mapState(['featured_onlinegames', 'latest_news'])
},
i want to dispatch an actions featuredOnlinegames and latestNews now with the way am using above it's not working i only get data from the featuredOnlinegames action but the latestNews return empty array
now here is my vuex code
export default {
state: () => ({
featured_onlinegames: [],
latest_news: []
}),
mutations: {
GET_FEATURED_ONLINEGAMES(state, featured_onlinegames){
state.featured_onlinegames = featured_onlinegames;
},
GET_LATEST_NEWS(state, latest_news){
state.latest_news = latest_news;
}
},
actions: {
async featuredOnlinegames({commit}) {
await this.$axios.get('/api/featured-onlinegames').then(res => {
commit('GET_FEATURED_ONLINEGAMES', res.data)
})
},
async latestNews({commit}) {
await this.$axios.get('/api/latest-news').then(res => {
commit('GET_LATEST_NEWS', res.data);
});
}
}
}
and one more question i don't know but when i started learning nuxt because everybody keep saying that nuxt is SEO friendly but with all these http request i have to send to get data from my db don't that kills the website and just add more weight to it and slow it down? right now am building a website and am still working on the top section of the website and i already have 4 http request to get data from db using axios not mentioning the images and the css and more, I have some dought that vue js nuxt is indeed SEO friendly will be more than glad if you helped clarify this for me and thanks a lot