Im having to use craft on a project, I have used Vue.js on the front end but cant get the VUEX store to fire actions:
My Vue store file is as follows:
import Vue from "vue";
import Vuex from "vuex";
import bookingFunnel from "../store/booking-funnel/index";
Vue.use(Vuex);
const store = new Vuex.Store({
modules: {
bookingFunnel
}
});
export default store;
With the import looking as such:
export default {
namespaced: true,
state: {
language: 'lang',
visible: true,
vehicleId: null,
quote: null
},
getters: {
getLanguage(state) {
return state.language;
},
getVisible(state) {
return state.visible;
},
getApiUrl(state) {
return state.apiUrl;
},
getVehicleId(state) {
return state.vehicleId;
}
},
mutations: {
toggle(state, payload) {
state.visible = payload
},
setVehicleId(state, payload) {
state.vehicleId = payload;
},
updateQuote(state, payload) {
state.quote = payload
}
},
actions: {
toggleVisible(state) {
state.commit('toggle', !state.state.visible);
},
updateVehicleId(state, payload) {
state.vehicle_id = payload;
}
},
};
And my import as follows:
import store from "../vuejs/store/index";
new Vue({
el: "#app",
delimiters: ["${", "}"],
store,
methods: {
...mapActions({
toggleVisible: 'bookingFunnel/toggleVisible',
updateVehicleId: 'bookingFunnel/updateVehicleId'
}),
},
});
To which I get the following error when i run:
this.$store.dispatch('updateVehicleId', id)
[vuex] unknown action type: updateVehicleId