我正在按如下方式进行提取请求,并注意到错误的控制台消息被打印为
fetch(FI_API),
{ credentials: 'include' })
.then(r => r.json())
.then(res => console.log(res))
.catch((e) => {
console.log(e);
});
Failed to load https://FI_API/api/company/search?q=fac: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://mdcds.ok.com:3001' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
SuggestCheck.tsx:91 TypeError: Failed to fetch
但是我注意到Chrome控制台中的请求确实以200完成,并且响应具有预期的值。有没有办法忽略401并获得200之后返回的结果?