React native我正在使用获取获取网络请求失败

问题描述 投票:0回答:1

Error on react native debugger

我正在尝试将Blob图像发送到服务器,但是本机反应是显示错误网络失败错误。

get_data = async () => {
let file = new FormData();

fetch("https://jzzqf.sse.codesandbox.io/", {
  method: "POST",
  headers: {
    "Content-Type": "multipart/form-data; charset=utf-8",
    //"Content-Type": "text/html; charset=utf-8",
    "Access-Control-Allow-Origin": "*"
  },
  mode: "no-cors",
  body: file
})
  .then(function(response) {
    alert(response);
  })
  .catch(function(error) {
    alert(error);
  });

};

react-native server fetch blob image-upload
1个回答
0
投票

切换您的然后处理诺言拒绝

.then(response => 
  {
    alert(response);
  }, reject => {
    // handle reject here
 })
© www.soinside.com 2019 - 2024. All rights reserved.