diff options
author | liamfallon <liam.fallon@est.tech> | 2021-11-09 15:22:22 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2021-11-10 08:57:23 +0000 |
commit | 2022e5ce5a03788a6edc5761c495cfadc5ded485 (patch) | |
tree | 2df93f088fb323440945ce93ce67be1f2208c9bf /runtime/ui-react/src/api/UserService.js | |
parent | 579085240812aa593ebafe787d97868e16fc3318 (diff) |
Align ui-react file in policy-clamp and policy-gui
When the ui-react code was transferred to policy-gui, the white space
was cleaned up and reformatted. This makes it difficult to track the
real functional changes if any between ui-react in policy-clamp and
policy-gui.
This review brings the white space changes into ui-react in policy-clamp
to make file comparisons easier.
Issue-ID: POLICY-3358
Change-Id: Ic303e71b341e5c0f7ca0de0ed4c4962ebf2f988a
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'runtime/ui-react/src/api/UserService.js')
-rw-r--r-- | runtime/ui-react/src/api/UserService.js | 97 |
1 files changed, 49 insertions, 48 deletions
diff --git a/runtime/ui-react/src/api/UserService.js b/runtime/ui-react/src/api/UserService.js index 5fb4aa6b4..bcf46ea64 100644 --- a/runtime/ui-react/src/api/UserService.js +++ b/runtime/ui-react/src/api/UserService.js @@ -22,53 +22,54 @@ */ export default class UserService { - static notLoggedUserName='Anonymous'; - static login() { - return fetch(window.location.pathname + 'restservices/clds/v1/user/getUser', { - method: 'GET', - credentials: 'same-origin' - }) - .then(function (response) { - console.debug("getUser response received, status code:", response.status); - if (response.ok) { - return response.text(); - } else { - console.error("getUser response is nok"); - return UserService.notLoggedUserName; - } - }) - .then(function (data) { - console.info ("User connected:",data) - return data; - }) - .catch(function(error) { - console.warn("getUser error received, user set to: ",UserService.notLoggedUserName); - console.error("getUser error:",error); - return UserService.notLoggedUserName; - }); - } + static notLoggedUserName = 'Anonymous'; - static getUserInfo() { - return fetch(window.location.pathname + 'restservices/clds/v2/clampInformation', { - method: 'GET', - credentials: 'same-origin' - }) - .then(function (response) { - console.debug("getUserInfo response received, status code:", response.status); - if (response.ok) { - return response.json(); - } else { - return {} - } - }) - .then(function (data) { - console.info ("User info received:",data) - return data; - }) - .catch(function(error) { - console.warn("getUserInfo error received, user set to: ",UserService.notLoggedUserName); - console.error("getUserInfo error:",error); - return {}; - }); - } + static login() { + return fetch(window.location.pathname + 'restservices/clds/v1/user/getUser', { + method: 'GET', + credentials: 'same-origin' + }) + .then(function (response) { + console.debug("getUser response received, status code:", response.status); + if (response.ok) { + return response.text(); + } else { + console.error("getUser response is nok"); + return UserService.notLoggedUserName; + } + }) + .then(function (data) { + console.info("User connected:", data) + return data; + }) + .catch(function (error) { + console.warn("getUser error received, user set to: ", UserService.notLoggedUserName); + console.error("getUser error:", error); + return UserService.notLoggedUserName; + }); + } + + static getUserInfo() { + return fetch(window.location.pathname + 'restservices/clds/v2/clampInformation', { + method: 'GET', + credentials: 'same-origin' + }) + .then(function (response) { + console.debug("getUserInfo response received, status code:", response.status); + if (response.ok) { + return response.json(); + } else { + return {} + } + }) + .then(function (data) { + console.info("User info received:", data) + return data; + }) + .catch(function (error) { + console.warn("getUserInfo error received, user set to: ", UserService.notLoggedUserName); + console.error("getUserInfo error:", error); + return {}; + }); + } } |