function createPost(values, callback) {
  const request = axios.post(`${ROOT_URL}/posts${API_KEY}`, values)
    .then(() => callback());

  return {
    type: CREATE_POST,
    payload: request
  }
}
/*
  createPost() action creator
  - receives values object { title, categories, content }
  - make request using axios
  - return object with action type and request as payload
  - request returns data for post with 'id' added

  The callback function is used to navigate to index after post is created
*/
createPost() action creator
receives values object { title, categories, content }
make request using axios
return object with action type and request as payload
request returns data for post with 'id' added

The callback function is used to navigate to index after post is created
createPost () action creator receives values object { title categories content } make request using axios return object with action type and request as payload request returns data for post with ' id ' added The callback function is used to navigate to index after post is created
function createPost(values, callback) {
  const request = axios.post(`${ROOT_URL}/posts${API_KEY}`, values)
    .then(() => callback());
  return {
    type: CREATE_POST,
    payload: request
  }
}
function createPost ( values , callback ) { const request = axios . post ( ` ${ ROOT_URL } ${ API_KEY } ` , values ) . then ( ( ) => callback ( ) ) ; return { type : CREATE_POST , payload : request } }
createPost() action creator
 receives values object { title, categories, content }
 make request using axios
 return object with action type and request as payload
 request returns data for post with 'id' added
createPost () action creator receives values object { title categories content } make request using axios return object with action type and request as payload request returns data for post with ' id ' added