【问题标题】:React native call API axios networkReact 原生调用 API axios 网络
【发布时间】:2020-09-11 16:24:03
【问题描述】:

我正在尝试通过使用 Axios 调用来获取 react-native 接口上的 API,但出现网络错误。我的 API 是用 .net core 3.0 版编写的。 我已成功尝试邮递员但未能致电 请帮我修复它。enter image description here

enter image description here

【问题讨论】:

  • 可能是CORS问题?
  • 请仔细检查同一网络下的IP 10:20:*:* vs localhost。

标签: react-native


【解决方案1】:

您可以在您的 axios 请求中传递标头来修复 CORS 作为 Ketan Rampteke 的回复。 Follow link.

Chao thân ái người anh em

【讨论】:

    猜你喜欢
    • 2021-01-06
    • 2018-09-01
    • 2019-10-02
    • 2021-10-20
    • 1970-01-01
    • 2021-12-26
    • 2021-10-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多