Answer the question
In order to leave comments, you need to log in
Why is the getter called twice?
Reproduce error in sandbox not getting
JSON
{
"documents": [
{
"id": "2175153000",
"person": "Иванов Иван Иванович",
},
{
"id": "2175153001",
"person": "Иванов Иван Иванович2",
}
]
}
export const getDocuments = () => {
return axios.get('../../static/documents.json')
.then(({
data
}) => {
if (data.errors) throw new Error(data.errors);
return data;
})
};
getDocuments({ commit }) {
getDocuments().then(response => {
commit('setDocuments', response);
}).catch(errors => {
console.error(errors);
});
},
setDocuments(state, payload) {
state.documents = payload.documents;
},
docStatuses(state) {
console.log(state.documents)
}
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