I am building a React Native mobile application that is using a Laravel backend, currently running on localhost:8000. When making a fetch request from an Android device to my server, my application gets the following error logs:
My code is below:
export default class App extends Component {
login() {
fetch('http://localhost:8000/api/establishments/get')
.then((response) => response.json())
.then((responseJson) => {
console.log('success!');
})
.catch((error) => {
console.error(error);
});
}
render() {
return (
<TouchableOpacity activeOpacity={.5} onPress={() => this.login()}>
<Text>Sign In</Text>
</TouchableOpacity>
);
}
}
When I copy and paste the exact route into my browser, the server responds successfully and completely as expected. I believe it is an issue with network permissions from my application? I have only just began learning React Native a week ago and would appreciate any help at all.
