React native fetch doesn't resolve or reject API request

Viewed 354

I always get correct response from this request in my browser console:

fetch('http://178.62.66.29:8080/api/v1/auth/1/2', {
    method: "GET",
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
    },
})
    .then(response => response.json())
    .then(responsejson =>  console.log(responsejson))
    .catch(err => console.error(err));

But when I use the exact same code in React native (Android) the fetch function doesn't resolve or reject anything. The thing is, sometimes the fetch function works (Like 1/10) which makes this problem even more confusing to me.

0 Answers
Related