在这个动作中,我在URL“api/media/action”上有一个基本的GET响应
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
})
}
}
在App.js中,路由被定义为:
通过启动该动作,我在后端收到了以下错误:
[26/Jul/2023 20:47:24] "GET /work/api/media/works/ HTTP/1.1" 404 2712
我不明白为什么在GET请求中添加了“work”
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号