We need to make some changes to the BlogMap component to integrate our Vuex store.
- In the BlogMap.vue component, we can add the Vuex helpers for the posts namespaced module, while renaming the ones we already have for the maps module:
// Vuex mappers
// maps module
const {
mapGetters: mapsGetters,
mapActions: mapsActions,
} = createNamespacedHelpers('maps')
// posts module
const {
mapGetters: postsGetters,
mapActions: postsActions,
} = createNamespacedHelpers('posts')
- Add the draft getter:
computed: {
...mapsGetters([
'center',
'zoom',
]),
...postsGetters([
'draft',
]),
// ...
},
- Add the setDraftLocation action as well:
methods: {
...mapsActions([
'setCenter',
'setUserPosition',
'setZoom',
]),
...postsActions([
'setDraftLocation',
]),
},