Skip to content
Snippets Groups Projects

525 dashborad shows no authentication values error randomly

1 file
+ 7
13
Compare changes
  • Side-by-side
  • Inline
@@ -27,9 +27,6 @@ const ViamAPI = require('../../temp/viamapi');
@@ -27,9 +27,6 @@ const ViamAPI = require('../../temp/viamapi');
var identityColors = ["#994392", "#cb0767", "#e51d31", "#ec671b", "#fab610"];
var identityColors = ["#994392", "#cb0767", "#e51d31", "#ec671b", "#fab610"];
/** This flag blocks execution of getNewEvents while we logging out **/
let logoutInProgress = false;
function getNextColor() {
function getNextColor() {
var colorIndex = localStorage.getItem("colorIndex");
var colorIndex = localStorage.getItem("colorIndex");
if (colorIndex == null || colorIndex === "") {
if (colorIndex == null || colorIndex === "") {
@@ -723,17 +720,20 @@ const connection = Penpal.connectToParent({
@@ -723,17 +720,20 @@ const connection = Penpal.connectToParent({
};
};
}
}
logoutInProgress = true;
// Clone headers to be able destroy authentication first
 
const headers = {...window.viamApi.getConfig().headers};
 
 
destroyAuthentication();
const identityLogoutResponse = await executeRestfulFunction(
const identityLogoutResponse = await executeRestfulFunction(
"private",
"private",
window.viamApi,
window.viamApi,
window.viamApi.identityLogout,
window.viamApi.identityLogout,
null
{
 
headers
 
}
);
);
destroyAuthentication();
return identityLogoutResponse;
return identityLogoutResponse;
} catch (e) {
} catch (e) {
return {
return {
@@ -741,8 +741,6 @@ const connection = Penpal.connectToParent({
@@ -741,8 +741,6 @@ const connection = Penpal.connectToParent({
code: "400",
code: "400",
status: e.message
status: e.message
};
};
} finally {
logoutInProgress = false;
}
}
},
},
identityRestoreAccess(restoreAccessIdentity, identificator) {
identityRestoreAccess(restoreAccessIdentity, identificator) {
@@ -1425,10 +1423,6 @@ connection.promise.then(parent => {
@@ -1425,10 +1423,6 @@ connection.promise.then(parent => {
}
}
setInterval(() => {
setInterval(() => {
if (logoutInProgress) {
return;
}
if (window.currentlyLoadedIdentity && !anynomousDeviceKeyEventsProcessing && !window.currentlyAuthenticatedIdentity) {
if (window.currentlyLoadedIdentity && !anynomousDeviceKeyEventsProcessing && !window.currentlyAuthenticatedIdentity) {
getNewEventsWithoutSession();
getNewEventsWithoutSession();
}
}
Loading