0๐
- Some props are missing in data block, for instance this.res, this.response
- First you should send axios request and AFTER that change this.companies:
instead of
Object.assign(this.companies[this.editedIndex], this.editedItem);
try {
let res = await axios.post(
"http://localhost:8888/api_test/config-panel/client.php?method=updateCustomer",
{
id: this.editedItem.ID,
name: this.editedItem.name,
telephone: this.editedItem.telephone,
email: this.editedItem.email,
website: this.editedItem.website,
location: this.editedItem.location
}
);
you should first send POST request:
try {
let res = await axios.post(
"http://localhost:8888/api_test/config-panel/client.php?method=updateCustomer",
{
id: this.editedItem.ID,
name: this.editedItem.name,
telephone: this.editedItem.telephone,
email: this.editedItem.email,
website: this.editedItem.website,
location: this.editedItem.location
}
);
Object.assign(this.companies[this.editedIndex], this.editedItem);
- A server-side method for POST should return ID of a newly created item. Then this ID should be placed in this.editemItem before appending it to companies array
The same goes for PUT (except p.3)
- [Vuejs]-Vue.js: How to prevent the user from entering characters other than letters and numbers
- [Vuejs]-How can I pass vuex getter to module which isn't vuejs component, but keep it reactive?
Source:stackexchange.com