{try{dispatch({type:WORK_LIST_REQUEST})const{data}=awaitaxios.get( 'api/media/works/')dispatch({type:WORK_LIST_SUCCESS"> Axios GET request was modified by something in the frontend-PHP Chinese Network Q&A
Axios GET request was modified by something in the frontend
P粉195200437
P粉195200437 2023-09-20 08:39:45
0
1
483

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:

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粉195200437
P粉195200437

reply all (1)
P粉482108310

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://`.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!