improve sessions.created behavior

This commit is contained in:
srgooglo 2022-09-07 13:26:37 +02:00
parent 0726833e9b
commit f43a20548e
2 changed files with 8 additions and 2 deletions

View File

@ -92,7 +92,7 @@ class App extends React.Component {
"session.logout": async () => {
await this.sessionController.logout()
},
"new_session": async () => {
"session.created": async () => {
await this.flushState()
await this.initialization()
},
@ -380,6 +380,12 @@ class App extends React.Component {
}
}
},
() => {
// if is `/login` move to `/`
if (window.location.pathname === "/login") {
app.setLocation("/")
}
},
]
await Promise.tasked(initializationTasks).catch((reason) => {

View File

@ -46,7 +46,7 @@ export default class Session {
}
Session.token = token
window.app.eventBus.emit("new_session")
window.app.eventBus.emit("session.created")
}
})
}