mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-29 15:26:27 +00:00
Get the list of unread notifications from the server
This commit is contained in:
parent
d0e7682b01
commit
ab528402b2
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
@ -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);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user