mirror of
https://github.com/go-gitea/gitea
synced 2024-11-25 17:02:50 +01:00
parent
564102ce89
commit
a988237eb4
3 changed files with 13 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
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;
|
||||
|
@ -95,7 +96,7 @@ export function initNotificationCount() {
|
|||
type: 'close',
|
||||
});
|
||||
worker.port.close();
|
||||
window.location.href = `${appSubUrl}/`;
|
||||
logoutFromWorker();
|
||||
} else if (event.data.type === 'close') {
|
||||
worker.port.postMessage({
|
||||
type: 'close',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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;
|
||||
|
||||
|
@ -77,7 +78,7 @@ export function initStopwatch() {
|
|||
type: 'close',
|
||||
});
|
||||
worker.port.close();
|
||||
window.location.href = `${appSubUrl}/`;
|
||||
logoutFromWorker();
|
||||
} else if (event.data.type === 'close') {
|
||||
worker.port.postMessage({
|
||||
type: 'close',
|
||||
|
|
9
web_src/js/modules/worker.js
Normal file
9
web_src/js/modules/worker.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
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}/`;
|
||||
}
|
Loading…
Reference in a new issue