diff options
author | sebdet <sebastien.determe@intl.att.com> | 2019-08-26 14:29:11 -0700 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2019-08-26 14:29:11 -0700 |
commit | 687b8de49114454bb8f2bfcedeb4a447af4178b3 (patch) | |
tree | a41cddd3532ead349c0d7cdac9557975f5942c24 /ui-react/src/api | |
parent | 8e8273217c6d47215e2ae88c890889dbb0b70fee (diff) |
Fix the userInfo
Fix user Info window, now clicking on the user name make it appears +
attempt to add a logout
Issue-ID: CLAMP-393
Change-Id: I82686a848f7ccae95c1eab22f1923a8821ba76b1
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'ui-react/src/api')
-rw-r--r-- | ui-react/src/api/UserService.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ui-react/src/api/UserService.js b/ui-react/src/api/UserService.js index be21e692..37ec73d1 100644 --- a/ui-react/src/api/UserService.js +++ b/ui-react/src/api/UserService.js @@ -47,6 +47,31 @@ export default class UserService { return UserService.notLoggedUserName; }); } + + static logout() { + return fetch('/restservices/clds/v1/user/logout', { + method: 'POST', + credentials: 'same-origin', + }) + .then(function (response) { + console.debug("logout response received, status code:", response.status); + if (response.ok) { + return response.text(); + } else { + console.error("logout response is nok"); + return UserService.notLoggedUserName; + } + }) + .then(function (data) { + console.info ("User disconnected:",data) + return data; + }) + .catch(function(error) { + console.warn("logout error received, user set to: ",UserService.notLoggedUserName); + console.error("logout error:",error); + return UserService.notLoggedUserName; + }); + } static getUserInfo() { return fetch('/restservices/clds/v1/clds/cldsInfo', { |