Skip to content

Commit

Permalink
Update web.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lesichkovm authored Oct 9, 2022
1 parent c0a77a0 commit 08db983
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions web.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ function Registry(namespace) {
const valueDecoded = jsonDecode(value);
return this.decrypt(valueDecoded);
};

/**
* Sets a value to a key
* @param {string} key
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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
*
Expand Down

0 comments on commit 08db983

Please sign in to comment.