import * as types from '../constants/ActionTypes'
import fetch from 'isomorphic-fetch'
import http from 'http'

const agent = new http.Agent({ keepAlive: true })

export function toggleSidebar (sideOpen) {
  return (dispatch) => {
    return dispatch({'type': types.TOGGLE_SIDEBAR, 'sideOpen': sideOpen})
  }
}

export function fetchFireSuccess (json) {
  return {'type': types.FETCH_FIRE_SUCCESS, 'fire': json};
}

export function fetchFire () {
  const API = process.env.API || 'http://localhost:3000/api'

  return (dispatch) => {
    return fetch(`${API}/getDB`)
      .then((response) => response.json())
      .then((json) => dispatch(fetchFireSuccess(json)))
      .catch((error) => console.log(error))
  }
}

@@ -83,83 +83,8 @@
 tch'
-%0Aimport http from 'http'%0A%0Aconst agent = new http.Agent(%7B keepAlive: true %7D)
 %0A%0Aex

clean up action