add support for delete

parent 8bddf3d6
......@@ -52,6 +52,7 @@
:viewpoint="record"
:action="action"
:record="record"
:delete="remove"
/>
<section id="card-holder">
......@@ -65,6 +66,8 @@
:title="vp.title"
:btn-edit-modal="user === collection.owner"
@showEdit="editCard(vp)"
:btn-delete="user === vp.owner"
@deleteCard="remove(vp.uuid)"
>{{ vp.introduction }}
</Card>
</span>
......@@ -127,6 +130,20 @@ export default {
},
methods: {
remove(item) {
console.log("item :", item)
API.post("/viewpoints/delete", {
user: this.$store.getters['user/uuid'],
item: item
}).then(() => {
API.get(`/viewpoints/slug/${this.slug}`).then(r => {
this.collection = { ...r.data.data };
this.$q.loading.hide();
});
})
},
editCard(item) {
console.log('EDIT VIEWPOINT: ', item);
this.action = 'Edit';
......
......@@ -37,6 +37,8 @@
:csstype="vp.is_visible ? 'ViewpointCollection' : 'private'"
:btn-edit-modal="user === vp.owner"
@showEdit="showEdit(vp)"
:btn-delete="user === vp.owner"
@deleteCard="remove(vp.uuid)"
:btn-publish="!vp.is_visible"
:btn-un-publish="vp.is_visible"
@publish="publish(vp)"
......@@ -72,11 +74,23 @@ export default {
},
methods: {
remove(uuid) {
let vm = this;
console.log("xx: ", uuid)
API.post('/viewpoints/delete/collection', {
collection: uuid,
user: vm.$store.getters['user/uuid']
}).then(() => {
vm.reload();
});
},
publish(vp) {
let vm = this;
API.post('/viewpoints/toggle/visibility', {
collection: vp.uuid,
session: this.$store.getters['user/session']
session: vm.$store.getters['user/session']
}).then(() => {
vm.reload();
});
......
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