Revert "Refactor GET 'me' into heartbeat at constant interval"
This reverts commit 298a8c47e1
.
Conflicts:
ui/src/index.js
pull/1119/head
parent
d75ba7712c
commit
b4773c15af
|
@ -25,8 +25,6 @@ import {loadLocalStorage} from './localStorage'
|
|||
|
||||
import 'src/style/chronograf.scss'
|
||||
|
||||
import {HEARTBEAT_INTERVAL} from 'shared/constants'
|
||||
|
||||
const store = configureStore(loadLocalStorage())
|
||||
const rootNode = document.getElementById('react-root')
|
||||
|
||||
|
@ -83,28 +81,17 @@ const Root = React.createClass({
|
|||
if (store.getState().me.links) {
|
||||
return this.setState({loggedIn: true})
|
||||
}
|
||||
|
||||
this.heartbeat({shouldDispatchResponse: true})
|
||||
},
|
||||
|
||||
async heartbeat({shouldDispatchResponse}) {
|
||||
try {
|
||||
const {data: me, auth} = await getMe()
|
||||
if (shouldDispatchResponse) {
|
||||
getMe().then(({data: me, auth}) => {
|
||||
store.dispatch(receiveMe(me))
|
||||
store.dispatch(receiveAuth(auth))
|
||||
this.setState({loggedIn: true})
|
||||
}
|
||||
} catch (error) {
|
||||
// TODO: verify that this is handling 403 and/or 401
|
||||
}).catch((error) => {
|
||||
if (error.auth) {
|
||||
store.dispatch(receiveAuth(error.auth))
|
||||
}
|
||||
|
||||
this.setState({loggedIn: false})
|
||||
}
|
||||
|
||||
setTimeout(this.heartbeat.bind(null, {shouldDispatchResponse: false}), HEARTBEAT_INTERVAL)
|
||||
})
|
||||
},
|
||||
|
||||
render() {
|
||||
|
|
|
@ -468,8 +468,6 @@ export const STROKE_WIDTH = {
|
|||
light: 1.5,
|
||||
}
|
||||
|
||||
export const HEARTBEAT_INTERVAL = 10000 // ms
|
||||
|
||||
export const PRESENTATION_MODE_ANIMATION_DELAY = 0 // In milliseconds.
|
||||
export const PRESENTATION_MODE_NOTIFICATION_DELAY = 2000 // In milliseconds.
|
||||
|
||||
|
|
Loading…
Reference in New Issue