From 756b0971381dd0ec5d57758c5362e04faa768295 Mon Sep 17 00:00:00 2001 From: Pierre Date: Fri, 12 Jan 2018 06:39:58 +0100 Subject: [PATCH] Update callback of post deletion. --- assets/js/components/posts/ui.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/assets/js/components/posts/ui.js b/assets/js/components/posts/ui.js index de480790..45076e23 100644 --- a/assets/js/components/posts/ui.js +++ b/assets/js/components/posts/ui.js @@ -198,7 +198,21 @@ ComunicWeb.components.posts.ui = { //Delete the post ComunicWeb.components.posts.interface.delete(infos.ID, function(response){ - postRoot.style.visibility = "visible"; + //Check for error + if(response.error){ + + //Display an error + ComunicWeb.common.notificationSystem.showNotification("An error occured while trying to delete post !", "danger"); + + //Make the post visible + postRoot.style.visibility = "visible"; + + return; + } + + //Delete the post + emptyElem(postRoot); + postRoot.remove(); }); });