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

product

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