I am new to both vue.js and vuex. I have a component that need to dispatch an action when a specific data is available in the state. How can I do this.
Example:
export default {
name: 'MyComponent',
computed: {
targetItem() {
return this.$store.getters.getTarget(this.$route.params.id);
}
}
}
In the example above i would like to dispatch a new action on the store when targetItem has a value. This is so i can trigger an ajax request via a vuex action to collect more data about targetItem
Thanks