import request from 'superagent';
export const ASYNC_CALL_STARTED = 'ASYNC_CALL_STARTED';

export function asyncStarted() {
  return {
    type: ASYNC_CALL_STARTED
  };
}

export function getRequest(url, successAction, errorAction, data = {}) {
  return (dispatch, getStore) => {
    dispatch(asyncStarted());
    request.get(url)
      .query(data)
      .end((err, res) => {
        if (err) {
          dispatch(errorAction(err));
        }

        dispatch(successAction(res.body));
      });
  };
}

export function postRequest(url, data, successAction, errorAction, headers = {}) {
  return (dispatch, getStore) => {
    dispatch(asyncStarted());

    request.post(url).send(data)
    .set(headers)
    .end((err, res) => {
      if (err) {
        dispatch(errorAction(err));
      }

      dispatch(successAction(res.body));
    });
  };
}

export function deleteRequest(url, successAction, errorAction, headers = {}) {
  return (dispatch, getStore) => {
    dispatch(asyncStarted());

    request.del(url)
    .set(headers)
    .end((err, res) => {
      if (err) {
        dispatch(errorAction(err));
      }

      dispatch(successAction(res.body));
    });
  };
}

@@ -835,32 +835,374 @@
     %7D);%0A  %7D;%0A%7D%0A%0A
+export function putRequest(url, data, successAction, errorAction, headers = %7B%7D) %7B%0A  return (dispatch, getStore) =%3E %7B%0A    dispatch(asyncStarted());%0A%0A    request.put(url).send(data)%0A    .set(headers)%0A    .end((err, res) =%3E %7B%0A      if (err) %7B%0A        dispatch(errorAction(err));%0A      %7D%0A%0A      dispatch(successAction(res.body));%0A    %7D);%0A  %7D;%0A%7D%0A%0A
 export function 

add put request to api actions