0
我正在使用React js(Admin on Rest)进行API调用(GET)。当API调用时出现React JS(Admin on Rest)错误
我已经检查API服务器上,当我打电话为localhost:5001 /引用,服务器返回数据的城市,但我不知道它在客户端上的错误,这里是从日志浏览器:
failure.js:18 Error: The X-Total-Count header is missing in the HTTP Response. This header is necessary for pagination. If you are using CORS, did you declare X-Total-Count in the Access-Control-Allow-Headers header?
at convertHTTPResponseToREST (http://localhost:3000/static/js/bundle.js:33928:28)
at http://localhost:3000/static/js/bundle.js:33966:21
和
failure.js:18 Error: The Content-Range header is missing in the HTTP Response. This header is necessary for pagination. If you are using CORS, did you declare Content-Range in the Access-Control-Allow-Headers header?
at convertHTTPResponseToREST (http://localhost:3000/static/js/bundle.js:33010:28)
at http://localhost:3000/static/js/bundle.js:33037:21
有人可以帮忙吗?谢谢
我认为您正在使用任何Package进行分页。 我不确定后端使用了哪种技术或框架。但是您需要在Access-Control-Allow-Headers标头中为后端应用(Rails,PHP或其他)提供Content-Range。 –
也许它包含在Admin on Rest框架中,我已经添加了标题,但仍然无效,或者我在设置标题时出错,我是新手在做出反应。所以你怎么看 ? – Khalid
此问题与后端应用程序有关,您只需在头中允许Content-Range。您正在为beckend应用程序使用哪个框架。 –