Hey there! I'm having an issue with using the fetch method in my mobile application. It's working fine in the web app, but in the mobile app, I'm getting an error saying "ReferenceError: fetch is undefined." I'm using the fetch method to skip retool's REST resource query and send the request directly from the mobile device.
Here's an example of my code in the "Query."
function sendJsonToEndpoint() {
const json = {"key": "value"};
const url = "http://a.com";
return fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(json)
})
.then(response => response.json())
.catch(error => console.error('Error:', error));
}
sendJsonToEndpoint();
I am looking forward to your response. I appreciate any help you can provide.