mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Perform a request over the server to get account settings
This commit is contained in:
		@@ -6,6 +6,18 @@
 | 
			
		||||
 | 
			
		||||
ComunicWeb.components.settings.interface = {
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get general account settings
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param {function} callback
 | 
			
		||||
	 */
 | 
			
		||||
	getGeneral: function(callback){
 | 
			
		||||
 | 
			
		||||
		//Make a request over the API
 | 
			
		||||
		var apiURI = "/settings/get_general/";
 | 
			
		||||
		var params = {};
 | 
			
		||||
		ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
 | 
			
		||||
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -31,6 +31,21 @@ ComunicWeb.pages.settings.sections.general = {
 | 
			
		||||
		//Display loading message
 | 
			
		||||
		var loadingMsg = ComunicWeb.common.messages.createCalloutElem("Loading", "Please wait while this page is loading...", "info");
 | 
			
		||||
		boxBody.appendChild(loadingMsg);
 | 
			
		||||
 | 
			
		||||
		//Load general settings information
 | 
			
		||||
		ComunicWeb.components.settings.interface.getGeneral(function(infos){
 | 
			
		||||
 | 
			
		||||
			//Remove loading message
 | 
			
		||||
			loadingMsg.remove();
 | 
			
		||||
 | 
			
		||||
			//Check for errors
 | 
			
		||||
			if(infos.error){
 | 
			
		||||
				var errMsg = ComunicWeb.common.messages.createCalloutElem("Error", "An error occured while retrieving account settings...", "danger");
 | 
			
		||||
				boxBody.appendChild(errMsg);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user