nikita15p commented on code in PR #3970:
URL: https://github.com/apache/ambari/pull/3970#discussion_r2030200616


##########
ambari-admin/src/main/resources/ui/ambari-admin/src/api/logout.ts:
##########
@@ -0,0 +1,35 @@
+import { encryptData, decryptData, getFromLocalStorage, parseJSONData, 
setInLocalStorage } from "./Utility.ts";
+import { adminApi } from "./configs/axiosConfig.ts";
+import { AxiosError } from 'axios';
+
+const signOut = async () => {
+    // var data = JSON.parse(decryptData(localStorage.getItem("ambari")));
+    let ambariKey = getFromLocalStorage('ambari');
+    let data;
+    if (ambariKey) {
+        data = parseJSONData(decryptData(ambariKey));
+    }
+    delete data.app.authenticated;
+    delete data.app.loginName;
+    delete data.app.user;
+
+    //with encrypting set data in LS
+    setInLocalStorage('ambari', encryptData(JSON.stringify(data)));
+
+    const headers = {
+        'Authorization': 'Basic ' + 'invalid_username:password'

Review Comment:
   @zRains this implementation logic seems to be as per angular js 
implementation of ambari-admin 
[auth.js](https://github.com/apache/ambari/blob/trunk/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Auth.js)
 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to