mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
fix events
This commit is contained in:
parent
f7a9635c72
commit
663029066b
@ -76,7 +76,7 @@ class App extends React.Component {
|
|||||||
window.app.version = config.package.version
|
window.app.version = config.package.version
|
||||||
}
|
}
|
||||||
|
|
||||||
publicEvents = {
|
static publicEvents = {
|
||||||
"clearAllOverlays": function () {
|
"clearAllOverlays": function () {
|
||||||
window.app.DrawerController.closeAll()
|
window.app.DrawerController.closeAll()
|
||||||
},
|
},
|
||||||
@ -111,13 +111,15 @@ class App extends React.Component {
|
|||||||
app.eventBus.emit("app.createLogin")
|
app.eventBus.emit("app.createLogin")
|
||||||
},
|
},
|
||||||
"invalid_session": async (error) => {
|
"invalid_session": async (error) => {
|
||||||
if (!this.state.session) {
|
const token = await Session.token
|
||||||
|
|
||||||
|
if (!this.state.session && !token) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.sessionController.forgetLocalSession()
|
await this.sessionController.forgetLocalSession()
|
||||||
await this.flushState()
|
await this.flushState()
|
||||||
|
|
||||||
app.eventBus.emit("forceToLogin")
|
app.eventBus.emit("forceToLogin")
|
||||||
|
|
||||||
antd.notification.open({
|
antd.notification.open({
|
||||||
@ -130,6 +132,9 @@ class App extends React.Component {
|
|||||||
icon: <Icons.MdOutlineAccessTimeFilled />,
|
icon: <Icons.MdOutlineAccessTimeFilled />,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
"no_session": async () => {
|
||||||
|
app.eventBus.emit("forceToLogin")
|
||||||
|
},
|
||||||
"websocket_connected": () => {
|
"websocket_connected": () => {
|
||||||
if (this.wsReconnecting) {
|
if (this.wsReconnecting) {
|
||||||
this.wsReconnectingTry = 0
|
this.wsReconnectingTry = 0
|
||||||
@ -380,7 +385,7 @@ class App extends React.Component {
|
|||||||
const token = await Session.token
|
const token = await Session.token
|
||||||
|
|
||||||
if (!token || token == null) {
|
if (!token || token == null) {
|
||||||
window.app.eventBus.emit("forceToLogin")
|
window.app.eventBus.emit("no_session")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user