Make eventStream connection/reconnection more reliable

Also more logs on the server
This commit is contained in:
Deluan
2020-11-20 20:22:22 -05:00
parent c8c95bfb47
commit 3e8bee4f65
4 changed files with 121 additions and 61 deletions
+6 -1
View File
@@ -1,8 +1,9 @@
import jwtDecode from 'jwt-decode'
import md5 from 'md5-hex'
import { v4 as uuidv4 } from 'uuid'
import { baseUrl } from './utils'
import config from './config'
import { v4 as uuidv4 } from 'uuid'
import { startEventStream, stopEventStream } from './eventStream'
const authProvider = {
login: ({ username, password }) => {
@@ -38,6 +39,9 @@ const authProvider = {
)
// Avoid going to create admin dialog after logout/login without a refresh
config.firstTime = false
startEventStream().catch((e) =>
console.log('error setting up event stream:', e)
)
return response
})
.catch((error) => {
@@ -53,6 +57,7 @@ const authProvider = {
},
logout: () => {
stopEventStream()
removeItems()
return Promise.resolve()
},