Commit bf0dc658 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

delete products

parent 6aecb92f
...@@ -125,8 +125,9 @@ ...@@ -125,8 +125,9 @@
</v-toolbar> </v-toolbar>
</template> </template>
<template v-slot:item.actions="{ item }"> <template v-slot:item.actions="{ item }">
<v-icon small class="mr-2" @click=" editCategory(item.id)" :id ="item.id"> mdi-pencil </v-icon> <v-icon small @click=" editCategory(item.id)" :id ="item.id"> mdi-pencil </v-icon>
<v-icon small @click="deleteCategory(item.id,item)" :id ="item.id"> mdi-delete </v-icon> <v-icon small @click="deleteProduct(item.id,item)" :id ="item.id"> mdi-delete </v-icon>
<v-icon small @click="deleteProduct(item.id,item)" :id ="item.id"> mdi-account-details </v-icon>
</template> </template>
<template v-slot:no-data> <template v-slot:no-data>
<v-btn color="primary" @click="initialize"> Reset </v-btn> <v-btn color="primary" @click="initialize"> Reset </v-btn>
...@@ -322,23 +323,24 @@ export default { ...@@ -322,23 +323,24 @@ export default {
// console.log(file) // console.log(file)
// console.log(this.image) // console.log(this.image)
// }, // },
// deleteCategory(ID,index) { deleteProduct(ID,index) {
// this.editedIndex = this.products.indexOf(index); const self = this;
// if(confirm("Do you really want to delete?")){ this.editedIndex = this.products.indexOf(index);
// try{ if(confirm("Do you really want to delete?")){
// axios try{
// .delete(`http://127.0.0.1:8000/api/products/${ID}`) axios
// .then(response => { .delete(`http://127.0.0.1:8000/api/products/${ID}`)
// this.products.splice(this.editedIndex, 1); .then(response => {
// self.$toast.success('Category deleted successfully!',{ this.products.splice(this.editedIndex, 1);
// duration: 3000 self.$toast.success('Category deleted successfully!',{
// }); duration: 3000
// }) });
// } catch(error){ })
// console.log(error) } catch(error){
// } console.log(error)
// } }
// }, }
},
// getID(item) { // getID(item) {
// console.log(this.products.indexOf(item)) // console.log(this.products.indexOf(item))
// }, // },
......
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