Vue/Vuex unknown action type
Try this:
import { mapGetters, mapActions} from 'vuex'
computed: {
...mapGetters({
companies: 'company/allCompanies'
})
}
methods: {
...mapActions(['company/getCompanies', 'company/getEmployees'])
},
mounted() {
this['company/getCompanies']();
},
But, I like to do namespacing as done below, but it has an issue, refer the issue here.
methods: {
...mapActions('company', ['getCompanies', 'getEmployees'])
},
mounted() {
this.getCompanies();
this.getEmployees();
},
You can fix it with
this.$store.dispatch('company/getCompanies', null, {root:true})
Also use mapActions
method in the components