Simplify EventStream handling

This commit is contained in:
Deluan
2023-05-17 11:22:36 -04:00
parent 6bee4ed147
commit 4296741ec0
5 changed files with 47 additions and 90 deletions
+2 -7
View File
@@ -1,7 +1,6 @@
import jwtDecode from 'jwt-decode'
import { baseUrl } from './utils'
import config from './config'
import { startEventStream, stopEventStream } from './eventStream'
// config sent from server may contain authentication info, for example when the user is authenticated
// by a reverse proxy request header
@@ -48,9 +47,6 @@ const authProvider = {
storeAuthenticationInfo(response)
// Avoid "going to create admin" dialog after logout/login without a refresh
config.firstTime = false
if (config.devActivityPanel) {
startEventStream()
}
return response
})
.catch((error) => {
@@ -66,7 +62,6 @@ const authProvider = {
},
logout: () => {
stopEventStream()
removeItems()
return Promise.resolve()
},
@@ -90,11 +85,11 @@ const authProvider = {
},
getIdentity: () => {
return {
return Promise.resolve({
id: localStorage.getItem('username'),
fullName: localStorage.getItem('name'),
avatar: localStorage.getItem('avatar'),
}
})
},
}