Commit 038b61a2 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

product

parent bbd76dd3
......@@ -345,8 +345,8 @@ export default {
this.message = errors.response.data.message;
self.$toast.error('something went wrong while trying create!',{
duration: 3000
});
});
})
})
},
fileSelected(event){
console.log(event)
......
......@@ -393,11 +393,10 @@ export default {
editedIndex: -1,
editedItem: {
name: "",
id: "",
ordering: "",
status: "",
created_at: "",
updated_at: "",
category_id: "",
price: "",
description: "",
stock: "",
},
defaultItem: {
name: "",
......@@ -525,6 +524,9 @@ export default {
self.$toast.success('Product created successfully!', {
duration: 3000
})
this.editedItem = response.data.data
console.log(this.editedItem)
this.products.push(this.editedItem)
})
.catch(errors => {
this.$bvModal.hide('modal-create')
......@@ -588,6 +590,7 @@ export default {
this.eStock = item.stock
this.eDescription = item.description
this.eVariants = item.variants
this.editedIndex = this.products.indexOf(item)
},
updateProduct(ID) {
const self = this
......@@ -611,6 +614,9 @@ export default {
duration: 3000
});
console.log(response)
this.editedItem = response.data.data
this.$bvModal.hide('modal-edit')
Object.assign(this.products[this.editedIndex], 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