I'm considering the following two alternatives in my Vue app. Trying to decide whether to call an action from within another action, or if that's too messy.
Alternative one:
store.js
const actions = {
funcOne (context) {
//Do something
context.dispatch(funcTwo)
}
funcTwo () {
//Do something else
}
}
component.vue
methods: {
doSomething () {
this.$store.dispatch(funcOne)
}
}
Or alternative two:
store.js
const actions = {
funcOne () {
//Do something
}
funcTwo () {
//Do something else
}
}
component.vue
methods: {
doSomething () {
this.$store.dispatch(funcOne)
this.$store.dispatch(funcTwo)
}
}
Is there a best practice here or does it not matter which of these I choose?