In this action I have a basic GET response on the URL "api/media/action"
export const listWorks = async (dispatch) => { try{ dispatch({type:WORK_LIST_REQUEST}) const { data } = await axios.get('api/media/works/') dispatch({type:WORK_LIST_SUCCESS, payload:data}) } catch(error) { dispatch({type:WORK_LIST_FAIL, payload: error.response && error.response.data.detail ? error.response.data.detail : error.message }) } }
In App.js, routing is defined as:
<Route path='/work/:name'component={WorkScreen}/>
By launching the action, I received the following error on the backend:
[26/Jul/2023 20:47:24] "GET /work/api/media/works/ HTTP/1.1" 404 2712
I don't understand why "work" is added to the GET request
P粉4821083102023-09-21 00:15:25
URL `api/media/works/` is a relative path. It does not begin with `http://` or `https://` and is therefore treated as a path relative to the current URL from which the API call was made.
Try making the same request using an absolute URL starting with `http://` or `https://`.