网络请求因获取和展示而失败?

时间:2019-09-13 14:38:22

标签: react-native fetch expo

在一个新的expo应用程序中,我编写了与普通的react-native应用程序相同的操作,但它们不起作用。

过去,提取功能在非博览会应用上正常运行。

const f = await fetch(
    `${server}/u/login/app`,
    {
      cache: 'no-cache',
      credentials: 'same-origin',
      body: JSON.stringify({
        username: login,
        password,
      }),
      headers: {
        accept: 'application/json',
        'content-type': 'application/json',
      },
      method: 'POST',
    }
  );

我期望使用json对象得到200响应。 相反,它会抛出

TypeError: Network request failed
    at XMLHttpRequest.xhr.onerror

0 个答案:

没有答案