diff --git a/ui/src/index.js b/ui/src/index.js index aff11820a..2596631aa 100644 --- a/ui/src/index.js +++ b/ui/src/index.js @@ -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) { - store.dispatch(receiveMe(me)) - store.dispatch(receiveAuth(auth)) - this.setState({loggedIn: true}) - } - } catch (error) { - // TODO: verify that this is handling 403 and/or 401 + getMe().then(({data: me, auth}) => { + store.dispatch(receiveMe(me)) + store.dispatch(receiveAuth(auth)) + this.setState({loggedIn: true}) + }).catch((error) => { if (error.auth) { store.dispatch(receiveAuth(error.auth)) } this.setState({loggedIn: false}) - } - - setTimeout(this.heartbeat.bind(null, {shouldDispatchResponse: false}), HEARTBEAT_INTERVAL) + }) }, render() { diff --git a/ui/src/shared/constants/index.js b/ui/src/shared/constants/index.js index f15846a51..7ae12f866 100644 --- a/ui/src/shared/constants/index.js +++ b/ui/src/shared/constants/index.js @@ -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.