I have a react native app on a local machine which is to call an API from another local machine on the same networ with a fetch() method. But I keep getting this error
"Possible Unhandled Promise Rejected(id:0)" TypeError: Network request failed.
async function conversionRate() {
try {
let FC = global.code;
let TC = global.des_code;
const params = {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({ FC: TC }),
};
console.log(url + "servicePost/getConversionRate");
let response = fetch(url + "servicePost/getConversionRate", params)
.then((response) =\> response.json())
.then((data) =\> cnt(data));
// var responseJson = response.text();
} catch (error) {
console.log(error.toString());
}
}