import $ from 'jquery';
import {GET} from '../modules/fetch.js';
import {toggleElem} from '../utils/dom.js';
+import {logoutFromWorker} from '../modules/worker.js';
const {appSubUrl, notificationSettings, assetVersionEncoded} = window.config;
let notificationSequenceNumber = 0;
type: 'close',
});
worker.port.close();
- window.location.href = `${appSubUrl}/`;
+ logoutFromWorker();
} else if (event.data.type === 'close') {
worker.port.postMessage({
type: 'close',
import {createTippy} from '../modules/tippy.js';
import {GET} from '../modules/fetch.js';
import {hideElem, showElem} from '../utils/dom.js';
+import {logoutFromWorker} from '../modules/worker.js';
const {appSubUrl, notificationSettings, enableTimeTracking, assetVersionEncoded} = window.config;
type: 'close',
});
worker.port.close();
- window.location.href = `${appSubUrl}/`;
+ logoutFromWorker();
} else if (event.data.type === 'close') {
worker.port.postMessage({
type: 'close',
--- /dev/null
+import {sleep} from '../utils.js';
+
+const {appSubUrl} = window.config;
+
+export async function logoutFromWorker() {
+ // wait for a while because other requests (eg: logout) may be in the flight
+ await sleep(5000);
+ window.location.href = `${appSubUrl}/`;
+}