fix events

This commit is contained in:
srgooglo 2022-05-31 21:44:58 +02:00
parent f7a9635c72
commit 663029066b

View File

@ -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: <Icons.MdOutlineAccessTimeFilled />,
})
},
"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
}