所以我有一个 JSON
服务器正在运行
"scripts": {
"start": "json-server -p 3004 -w db.json"
},
并为其创建了 db.json
文件:
{
"streams": []
}
如果我去http://localhost:3004
然后在 React
方面,我有:
export const createStream = (formValues) => {
return async (dispatch) => {
streams.post("/streams", formValues);
};
};
其中 streams
是 Axios 包装器,如下所示:
import axios from "axios";
export default axios.create({
baseURL: "http://localhost/3004",
});
然后我调用它。我可以看到,即使我的表单值也在传递,如下所示:
但为什么最终失败并出现 NO_RESPONSE
错误?