From 7bf1cd408620e90084c6915066729a9b13a98704 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Fri, 20 Jan 2017 03:07:28 +0100 Subject: [PATCH] Remove item from page if state changed by user --- socialdragon/assets/js/app.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/socialdragon/assets/js/app.js b/socialdragon/assets/js/app.js index bf1073c..f5240c7 100644 --- a/socialdragon/assets/js/app.js +++ b/socialdragon/assets/js/app.js @@ -26,6 +26,10 @@ var app = new Vue({ req.open("POST", "/admin/approve/" + id); req.send(); this.showModal = false; + var index = this.items.indexOf(this.currentItem); + if (index > -1) { + this.items.splice(index, 1); + } }, rejectItem: function (id) { var req = new XMLHttpRequest(); @@ -35,6 +39,10 @@ var app = new Vue({ req.open("POST", "/admin/reject/" + id); req.send(); this.showModal = false; + var index = this.items.indexOf(this.currentItem); + if (index > -1) { + this.items.splice(index, 1); + } } } })