I'm trying to connect to server on another computer in my network, I'm trying to send and check login data (username and password) with fetch
to get json OK response. However, simulator is giving me error:
The code is this:
LogIn() {
fetch('192.168.5.13:8087/login', {
method: 'post',
body: JSON.stringify({
config_name: 'default',
username: this.state.username,
password: this.state.password,
})
})
I've been searching for a solution for a better part of the day, any ideas?
Assuming you've already tested the connection to your service through other means to confirm it's reachable via that address/port, you just need to add the correct protocol. Changing it to this (assuming it's not https) should do the trick.
http://192.168.5.13:8087/login
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With