admin管理员组

文章数量:1415684

This is the error i am getting : -

Below is the code : -

const login = async () => {
    console.log("running....")
    try {
      console.log("try block")
      const response = await fetch(";, {
        method: 'POST',
        headers: 
        { 
          Accept : "application/json",
          'Content-Type': 'application/json' 
        },
        body: JSON.stringify({ email: "[email protected]", }),
      });
  
      console.log("Response Status:", response.status);
      const jsonResponse = await response.json();
      console.log("Response:", jsonResponse);
    } catch (error) {
      console.error("Error:", error);
    }
  };

also set the file (network_security_config.xml)

`<!-- react native -->
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">;/domain>
    </domain-config>
    <!-- <base-config cleartextTrafficPermitted="true">
        <trust-anchors>
            <certificates src="system" />
        </trust-anchors>
    </base-config> -->
</network-security-config>`

AndroidMAnifest.xml

So i have tried

  1. changes AndroidMAnifest.xml (check above image)
  2. postman working fine
  3. other api is working

Above is dummy api but the problem is other apis i am able to get response just the main api not working.

本文标签: Not able to hit api in React Native only in Android (IOSPostman Working)Stack Overflow