我通过 axios 向后端发送请求,我的地址栏上的 URL 是“localhost:3000/topics/5ba06e74dbc”
但在我的浏览器检查器中它返回一个错误
"localhost:3000/topics/api/topics/5ba06e74dbc 404 (Not Found)" 请求应该是: "localhost:3000/api/topics/5ba06e74dbc" 任何人都知道为什么在前面添加了额外的 "topics/" api调用?
// my action call I suspect it might be because of my routes or because
//Im calling from topics/ already.
export const viewTopic = (id) => dispatch => {
return axios.get(`api/topics/${id}`).then(res => {
return dispatch({
type: VIEW_TOPIC,
payload: res.data
});
});
}
Run Code Online (Sandbox Code Playgroud)
看看我的 GitHub 或询问更多信息,我不确定要包含什么。
| 归档时间: |
|
| 查看次数: |
2611 次 |
| 最近记录: |