text: import * as types from '../constants/actionTypes';
  
  export const addBlog = (data) => (dispatch, getState) => dispatch({
    types: [types.API_REQUEST_SEND, types.BLOG_SET_SHOW, types.API_REQUEST_ERROR],
    payload: {
      request: {
        url: `api/v1/blogs`,
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${getState().auth.user.token}`
        },
        data
      }
    }
  });
  
  export const getBlogs = (page, limit) => (dispatch, getState) => {
    const params = {
      page,
      limit
    };
  
    return dispatch({
      types: [types.API_REQUEST_SEND, types.BLOG_SET_BROWSE, types.API_REQUEST_ERROR],
      payload: {
        request: {
          url: 'api/v1/blogs',
          method: 'GET',
          headers: {
            'Authorization': `Bearer ${getState().auth.user.token}`
          },
          params
        }
      }
    })
  };
  
  export const getBlog = (id) => (dispatch, getState) => dispatch({
    types: [types.API_REQUEST_SEND, types.BLOG_SET_SHOW, types.API_REQUEST_ERROR],
    payload: {
      request: {
        url: `api/v1/blogs/${id}`,
        method: 'GET',
        headers: {
          'Authorization': `Bearer ${getState().auth.user.token}`
        }
      }
    }
  });
  
  export const editBlog = (id, data) => (dispatch, getState) => dispatch({
    types: [types.API_REQUEST_SEND, types.BLOG_SET_SHOW, types.API_REQUEST_ERROR],
    payload: {
      request: {
        url: `api/v1/blogs/${id}`,
        method: 'PATCH',
        headers: {
          'Authorization': `Bearer ${getState().auth.user.token}`
        },
        data
      }
    }
  });
  
  export const deleteBlog = (id) => (dispatch, getState) => dispatch({
    types: [types.API_REQUEST_SEND, types.BLOG_DELETE_ITEM, types.API_REQUEST_ERROR],
    payload: {
      request: {
        url: `api/v1/blogs/${id}`,
        method: 'DELETE',
        headers: {
          'Authorization': `Bearer ${getState().auth.user.token}`
        }
      }
    },
    id: id
  });