Answer the question
In order to leave comments, you need to log in
How to call action after state change?
I make a date picker on Vue, after changes in the date picker, the state changes:
computed: {
month: {
get () {
return this.$store.budget.state.settings.month
},
set (value) {
this.$store.commit('budget/SET_SETTING', {setting: 'month', value})
}
}
},
state: {
settings: {
month: moment().month(),
quarter: 1,
viewType: "daysOfMonth",
year: moment().year(),
},
},
mutations: {
SET_SETTING(state, {setting, value}) {
state.settings[setting] = value
}
},
actions: {
GET ({ commit, state }) {
let {year, month} = state.settings
// ЗАПРОС
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question