From b932a12faad127497ee43ccdba4194ce23219fd2 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 16 Apr 2018 16:15:48 +0200 Subject: [PATCH] Perform a request over the server to get account settings --- assets/js/components/settings/interface.js | 14 +++++++++++++- assets/js/pages/settings/sections/general.js | 15 +++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/assets/js/components/settings/interface.js b/assets/js/components/settings/interface.js index 9d7f08d4..36710a88 100644 --- a/assets/js/components/settings/interface.js +++ b/assets/js/components/settings/interface.js @@ -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); + + }, } \ No newline at end of file diff --git a/assets/js/pages/settings/sections/general.js b/assets/js/pages/settings/sections/general.js index 2e4ceeef..2d26af0f 100644 --- a/assets/js/pages/settings/sections/general.js +++ b/assets/js/pages/settings/sections/general.js @@ -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); + } + + + }); } }; \ No newline at end of file