I am writing a function which makes an API call and return data from the API call. Then it has to go a new page for which the callback() function is called. When I run the code, I do navigate to the new page, but like after a few milliseconds, I get an error which is shown in a screenshot below. The code I am using is :

```
export function editPost(id, callback) {
  const request = axios.get(`${API}/posts/${id}`,{headers});
    return dispatch => {
      return request.then((data) => {
        callback();
        console.log(data);
        dispatch({
          type: EDIT_POST,
          payload: data
        })
      })
    }
}

```

The error message I get is shown below:

[![unhandled_rejection](https://i.stack.imgur.com/zpC99.png)](https://i.stack.imgur.com/zpC99.png)

Can anyone please help me with this?