Axios post request problem

Axios post request problem
0

#1

EDIT: It looks like axios is ignoring the proxy in package-json. Fetch also ignores it.

In one of my Redux actions I am making an axios post request to my backend and it is adding extra text that is equal to the front-end route (http://localhost:3000/forum/general-discussion/GIoKtPD/nttttttt)

I only want it to post to “api/forum/general-discussion/GIoKtPD/like”, but it adds the extra text in front even though I am not putting it in the request:

// Like Thread
export const likeThread = (forumSection, threadId) => dispatch => {
  axios
    .post(`api/forum/${forumSection}/${threadId}/like`)
    .then(res => {
      dispatch({
        type: GET_THREAD,
        payload: res.data
      });
    })
    .catch(err => dispatch({ type: GET_ERRORS, payload: err.response.data }));
};

The error:
POST http://localhost:3000/forum/general-discussion/GIoKtPD/nttttttt/api/forum/general-discussion/GIoKtPD/like 404 (Not Found)

Git Repo: (the axios request is being made in /client/src/actions/forumActions.js)


#2

Ok everyone, I figured it out. After looking up using fetch instead of axios and dealing with CORS errors I finally realized that I FORGOT A FORWARD SLASH on my route. smh