Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
K
kiaisoft_tuananh_nuxt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TTS Tran Viet Anh
kiaisoft_tuananh_nuxt
Commits
bf0dc658
Commit
bf0dc658
authored
Jan 16, 2023
by
TTS Kieu Tuan Anh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete products
parent
6aecb92f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
products.vue
pages/home/products.vue
+21
-19
No files found.
pages/home/products.vue
View file @
bf0dc658
...
...
@@ -125,8 +125,9 @@
</v-toolbar>
</
template
>
<
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=
"deleteCategory(item.id,item)"
:id =
"item.id"
>
mdi-delete
</v-icon>
<v-icon
small
@
click=
" editCategory(item.id)"
:id =
"item.id"
>
mdi-pencil
</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
v-slot:no-data
>
<v-btn
color=
"primary"
@
click=
"initialize"
>
Reset
</v-btn>
...
...
@@ -322,23 +323,24 @@ export default {
// console.log(file)
// console.log(this.image)
// },
// deleteCategory(ID,index) {
// this.editedIndex = this.products.indexOf(index);
// if(confirm("Do you really want to delete?")){
// try{
// axios
// .delete(`http://127.0.0.1:8000/api/products/${ID}`)
// .then(response => {
// this.products.splice(this.editedIndex, 1);
// self.$toast.success('Category deleted successfully!',{
// duration: 3000
// });
// })
// } catch(error){
// console.log(error)
// }
// }
// },
deleteProduct
(
ID
,
index
)
{
const
self
=
this
;
this
.
editedIndex
=
this
.
products
.
indexOf
(
index
);
if
(
confirm
(
"
Do you really want to delete?
"
)){
try
{
axios
.
delete
(
`http://127.0.0.1:8000/api/products/
${
ID
}
`
)
.
then
(
response
=>
{
this
.
products
.
splice
(
this
.
editedIndex
,
1
);
self
.
$toast
.
success
(
'
Category deleted successfully!
'
,{
duration
:
3000
});
})
}
catch
(
error
){
console
.
log
(
error
)
}
}
},
// getID(item) {
// console.log(this.products.indexOf(item))
// },
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment