From 08db983fbcf7f4e8d4923bb05cf67b06131f7b9a Mon Sep 17 00:00:00 2001 From: Milan Lesichkov Date: Sun, 9 Oct 2022 08:40:07 +0100 Subject: [PATCH] Update web.js --- web.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/web.js b/web.js index 60b0867..c83693d 100644 --- a/web.js +++ b/web.js @@ -85,6 +85,7 @@ function Registry(namespace) { const valueDecoded = jsonDecode(value); return this.decrypt(valueDecoded); }; + /** * Sets a value to a key * @param {string} key @@ -200,6 +201,16 @@ function Initialize() { this.set = function (key, value) { return Registry.set(key, value); }; + + /** + * Returns the API URL + * If an API_URL variable is set, will return as it is. Otherwise will + * generate one, assuming the API is hosted on the same domain {domain}/api + * @returns {String} + */ + this.getApiUrl = function () { + return Config.getApiUrl(); + }; /** * Returns the current page URL @@ -283,16 +294,12 @@ function Initialize() { this.setAuthToken = function (token) { return Registry.set("AuthToken", token); }; - + /** - * Returns the current language. + * Returns the current language, if set. * Key "CurrentLanguage" * @returns {Array} */ - this.setLanguage = function (language) { - return Registry.set("CurrentLanguage", language); - }; - this.getLanguage = function () { var language = Registry.get("CurrentLanguage"); if (language === null) { @@ -301,6 +308,15 @@ function Initialize() { return language; }; + /** + * Sets the current language. + * Key "CurrentLanguage" + * @returns {Array} + */ + this.setLanguage = function (language) { + return Registry.set("CurrentLanguage", language); + }; + /** * Redirects the user to the specified URL *