Preset HttpUtils Tool APIs
API |
Description |
---|---|
Obtains the value of a cookie. |
|
Sets a cookie value. |
|
Returns a Vue18n instance. |
|
Used when an API of the platform is invoked in AJAX mode. |
|
Access token used to manually refresh the page. |
|
Obtains parameters in the query string. |
|
Obtains the value of a localStorage. |
|
Sets the value of a localStorage. |
getCookie
Used to obtain the value of a cookie. The usage is as follows:
/* @param {*} cookieID */ HttpUtils.getCookie("key")
setCookie
Used to set the cookie value. The usage is as follows:
/* @param {*} key * @param {*} value */ HttpUtils.setCookie("key","value")
getI18n
It is used to return a Vue18n instance in the initialization phase and is used together with Vue and VueI18n. The usage is as follows:
/* * The Vue18n instance can be assigned an i18n parameter when a new Vue instance is created. */ HttpUtils.getI18n({ locale: HttpUtils.getLocale(), messages: thisObj.getMessages() })
getCsrfToken
Used to call the platform API in Ajax mode. The usage method is as follows:
/* * If the platform bridge is used, the platform automatically adds the csrf-token header to the request header. */ HttpUtils.getCsrfToken(function(csrfToken) { $.ajax({ headers: { CSRF-Token: csrfToken }, }) });
refreshToken
Used to manually refreshes the access token of the page. Generally, this method is executed to refresh the access token of the page when the exit logic is executed. The usage is as follows:
/* @param {*} connector * @param {*} successCallBack * @param {*} errorCallback */ HttpUtils.refreshToken(connector,successCallBack,successCallBack)
getUrlParam
Used to obtain parameters in the query string. The usage is as follows:
/* * For example, if the URL of a page is https://10.10.10.1:12900/magno/render/cool__app_0000000000NABzEjpNIH/page1?param=1, run the following command: * HttpUtils.getUrlParam("param") returns the value 1 of this parameter. */ HttpUtils.getUrlParam("param")
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot