diff --git a/packages/app/src/App.jsx b/packages/app/src/App.jsx index 9e3f9248..a58f592c 100644 --- a/packages/app/src/App.jsx +++ b/packages/app/src/App.jsx @@ -76,7 +76,7 @@ class App extends React.Component { window.app.version = config.package.version } - publicEvents = { + static publicEvents = { "clearAllOverlays": function () { window.app.DrawerController.closeAll() }, @@ -111,13 +111,15 @@ class App extends React.Component { app.eventBus.emit("app.createLogin") }, "invalid_session": async (error) => { - if (!this.state.session) { + const token = await Session.token + + if (!this.state.session && !token) { return false } - + await this.sessionController.forgetLocalSession() await this.flushState() - + app.eventBus.emit("forceToLogin") antd.notification.open({ @@ -130,6 +132,9 @@ class App extends React.Component { icon: , }) }, + "no_session": async () => { + app.eventBus.emit("forceToLogin") + }, "websocket_connected": () => { if (this.wsReconnecting) { this.wsReconnectingTry = 0 @@ -380,7 +385,7 @@ class App extends React.Component { const token = await Session.token if (!token || token == null) { - window.app.eventBus.emit("forceToLogin") + window.app.eventBus.emit("no_session") return false }