27 lines
886 B
JavaScript
27 lines
886 B
JavaScript
window.taxbaikAdminSession = {
|
|
clearAuthToken: function () {
|
|
try {
|
|
localStorage.removeItem('auth_token');
|
|
} catch {
|
|
// Ignore storage errors; redirect still recovers the session.
|
|
}
|
|
},
|
|
watchReconnect: function () {
|
|
const modal = document.getElementById('components-reconnect-modal');
|
|
if (!modal) {
|
|
return;
|
|
}
|
|
|
|
const reloadOnRejectedCircuit = () => {
|
|
const className = modal.className || '';
|
|
if (className.includes('components-reconnect-failed') ||
|
|
className.includes('components-reconnect-rejected')) {
|
|
window.setTimeout(() => window.location.reload(), 1500);
|
|
}
|
|
};
|
|
|
|
new MutationObserver(reloadOnRejectedCircuit)
|
|
.observe(modal, { attributes: true, attributeFilter: ['class'] });
|
|
}
|
|
};
|