Get the list of unread notifications from the server

This commit is contained in:
Pierre 2018-02-19 14:09:15 +01:00
parent d0e7682b01
commit ab528402b2
2 changed files with 28 additions and 3 deletions

View File

@ -82,9 +82,18 @@ ComunicWeb.components.notifications.dropdown = {
* *
* @param {HTMLElement} list The notifications list to refresh * @param {HTMLElement} list The notifications list to refresh
*/ */
refresh: function(list){ refresh_list: function(list){
//Perform a request on the database //Perform a request on the API
ComunicWeb.components.notifications.interface.get_list_unread(function(result){
//Check for errors
if(result.error){
ComunicWeb.common.notificationSystem.showNotification("An error occured while trying to retrieve notifications list !", "danger");
return;
}
});
}, },
} }

View File

@ -20,6 +20,22 @@ ComunicWeb.components.notifications.interface = {
//Perform the request //Perform the request
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback); ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
} },
/**
* Get the list of unread notifications
*
* @param {function} callback
*/
get_list_unread: function(callback){
//Perform API request
var apiURI = "notifications/get_list_unread";
var params = {};
//Perform the request
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
},
} }