0๐
โ
I fix it by creating an object and put the data into that object. After creating I pass it as an argument to action addArticle in my store.js
passToDB() {
let payload = {
TITLE: this.title,
SUBHEADER: this.subheader,
CONTENT: this.content,
CATEGORY: this.category
};
this.addArticle(payload);
here I received the payload coming from insert.vue file
async addArticle({ commit }, payload) {
const response = await axios.post('http://localhost:9001/article/add', payload);
commit('ADD_ARTICLE', response.data)
}
Source:stackexchange.com