In this lesson you will see how to use update product endpoint to update a product in the server. Since you have seen how to save new product in the previous video, doing this thing is much easier.
Just modify the update method in app.js file like so:
update () {
this.product.price = this.product.price * 100;
axios.put('/products/' + this.product.id, this.product)
.then(({ data }) => {
let index = this.products.findIndex(item => item.id === this.product.id);
this.products.splice(index, 1, data.data);
this.isEdit = false;
this.errors = {};
$(this.$refs.vuemodal).modal('hide');
})
.catch(({ response }) => {
this.errors = response.data.errors
})
}Save the change, and try to update a product. Now the change that you make will persist in the database server.