let url = "/"
fetch(url, {
headers: {
"Accept": "application/json",
"Content-Type": "application/json"
}
})
.then(resp => resp.json())
.then(data => {
setToken(1);
})
.catch(function(err) {
console.log('Fetch Error :-S', err);
});我有一个代理OK:http://localhost:3001/people“
我已经配置了这个json-server
{
"people": [
{
"id": "1",
"name": "gustavo",
"pass": "gustavo",
"days": {
"23/02/2021": [
{
"arrive": "09:00",
"lunchstart": "12:00",
"lunchend": "13:00",
"exit": "17:00"
}
],
"24/02/2021": [
{
"arrive": "09:00",
"lunchstart": "11:30",
"lunchend": "13:00",
"exit": "17:00"
}
]
}
}
]
}如果使用"/1“有效,如何使用"/"?
我也可以使用失眠症或邮递员,它适用于/people。
发布于 2021-02-27 06:47:50
我刚把代理改为:
"proxy": "http://localhost:3001"并取到:
let url = "people?name=gustavo" or
let url = "people"我花了两天时间来解决这个问题,但是感谢上帝哈哈。
有人有别的解决办法吗?
https://stackoverflow.com/questions/66396198
复制相似问题