Commit 064aae00 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

delete

parent 02906955
This diff is collapsed.
......@@ -1043,6 +1043,7 @@ export default {
this.eDescription = item.description
this.eVariants = item.variants
this.editedIndex = this.products.indexOf(item)
console.log(item.variants)
this.dialog3 = true
},
updateProduct (ID) {
......@@ -1053,6 +1054,7 @@ export default {
fd.append('category_id', this.eCategoryId)
fd.append('description', this.eDescription)
for (let i = 0; i < this.eVariants.length; i++) {
fd.append(`variants[${i}][id]`, this.eVariants[i].id)
fd.append(`variants[${i}][color]`, this.eVariants[i].color)
fd.append(`variants[${i}][quantity]`, this.eVariants[i].quantity)
fd.append(`variants[${i}][size]`, this.eVariants[i].size)
......@@ -1060,6 +1062,7 @@ export default {
for (let j = 0; j < this.eImages.length; j++) {
fd.append(`images[${j}]`, this.eImages[j])
}
const currentPostIndex = this.editedIndex
try {
this.$axios
.post(`/products/update/${this?.eId}`,
......@@ -1076,8 +1079,7 @@ export default {
})
console.log(response)
this.editedItem = response.data.data
this.$bvModal.hide('modal-edit')
Object.assign(this.products[this.editedIndex], this.editedItem)
Object.assign(this.products[currentPostIndex], this.editedItem)
})
} catch (error) {
console.log(error)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment