mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Get the list of unread notifications from the server
This commit is contained in:
		@@ -82,9 +82,18 @@ ComunicWeb.components.notifications.dropdown = {
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @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
 | 
			
		||||
		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);
 | 
			
		||||
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user