A
A
Aleksandr2018-06-06 11:58:22
Vue.js
Aleksandr, 2018-06-06 11:58:22

Why doesn't the data come into the mutation?

There is such an action

getFields({ commit, dispatch }) {
    getFields().then(response => {
      let formFieldsMap = response.formFields.map(n => ({ ...n, value: '' }))
      console.log('1', formFieldsMap)
      commit(SET_FIELDS_TRANSPORT, formFieldsMap);
    }).catch(errors => {
      console.error(errors);
    });
},

Everything is in the console

AND there is a mutation
[SET_FIELDS_TRANSPORT](state, { formFieldsMap }) {
    console.log(formFieldsMap)
    state.FIELDS.formFields = formFieldsMap;
},


here already nothing comes in formFieldsMap
How so?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-06-06
@Sashjkeee

Why are you destructuring? Well, think for yourself - where will the formFieldsMap property come from if you pass an array to the mutation?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question