From fee007d127e4bb5f784b5ffcbb141a798620b523 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 25 Jun 2017 16:30:55 +0200 Subject: [PATCH] Prepared conversation callback function --- assets/js/components/conversations/interface.js | 4 ---- assets/js/components/conversations/service.js | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/assets/js/components/conversations/interface.js b/assets/js/components/conversations/interface.js index 5ff9c55c..961ad47c 100644 --- a/assets/js/components/conversations/interface.js +++ b/assets/js/components/conversations/interface.js @@ -274,10 +274,6 @@ ComunicWeb.components.conversations.interface = { */ refreshConversations: function(newConversations, toRefresh, callback){ - //DEBUG log informations - console.log("New conversations", newConversations); - console.log("To refresh", toRefresh); - //Perform a request on the API var apiURI = "conversations/refresh"; var params = { diff --git a/assets/js/components/conversations/service.js b/assets/js/components/conversations/service.js index 0aa942d4..e2e9849b 100644 --- a/assets/js/components/conversations/service.js +++ b/assets/js/components/conversations/service.js @@ -135,10 +135,21 @@ ComunicWeb.components.conversations.service = { /** * Service callback function * - * @param {Object} + * @param {Object} result The result of the request * @return {Boolean} True for a success */ - callback: function(){ + callback: function(result){ + + //Check for errors + if(result.error){ + ComunicWeb.debug.logMessage("Conversations Service : Couldn't update conversations !"); + + //Display a notification + ComunicWeb.common.notificationSystem.showNotification("An error occured while trying to refresh conversations system !", "danger", 1.5); + } + else { + //We can continue with the result + } //Unlock service this.__serviceLock = false;