summaryrefslogtreecommitdiffstats
path: root/ui-react/src/api/UserService.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui-react/src/api/UserService.js')
-rw-r--r--ui-react/src/api/UserService.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/ui-react/src/api/UserService.js b/ui-react/src/api/UserService.js
index 814539551..8f53d7b8a 100644
--- a/ui-react/src/api/UserService.js
+++ b/ui-react/src/api/UserService.js
@@ -22,28 +22,29 @@
*/
export default class UserService {
-
- static LOGIN() {
+ static notLoggedUserName='Anonymous';
+ static login() {
return fetch('/restservices/clds/v1/user/getUser', {
method: 'GET',
credentials: 'include',
})
.then(function (response) {
+ console.debug("getUser response received, status code:", response.status);
if (response.ok) {
- console.log("getUser response received: ", response.status);
return response.text();
} else {
- console.error("getUser failed with status code: ",response.status);
- return "Anonymous";
+ console.error("getUser response is nok");
+ return UserService.notLoggedUserName;
}
})
.then(function (data) {
- console.log ("User connected:",data)
+ console.info ("User connected:",data)
return data;
})
.catch(function(error) {
- console.error("getUser error received",error);
- return "Anonymous";
+ console.warn("getUser error received, user set to: ",UserService.notLoggedUserName);
+ console.error("getUser error:",error);
+ return UserService.notLoggedUserName;
});
}
}