My project involves scanning a qr code that opens a react form page on a mobile phone.
The app runs on the my computer, while only the form page is to be accessible to users via qr on the phone.
To test it out during development, I run my project in localhost, then shared my laptop’s mobile hotspot with my phone to get to the page (to get the local Ipv4 address).
Opening the page works, but submitting the form’s data to the database (postman localhost) results in the error NET::ERR_CERT_AUTHORITY_INVALID.
My question then, is the method I’m doing possible?
Can I make an API call through my phone’s hotspot URL?
I tried by setting my URL on fetching the API to the URL of my laptop’s local ipv4 address
await fetch(
"https://192.168.xx.xx/api/getdata",
{
method: "POST",
body: JSON.stringify(visitor),
headers: {
"Content-Type": "application/json",
},
}
);
- laptop = https://192.168.xx.xx (last digits are 1)
API calls work fine on my laptop that runs the code,
but it fails on my phone.
- phone = https://192.168.xx.xx (last digits are 151)
Is it because my phone is using a different URL compared to my laptop?
(and fetching the API is using my laptop’s URL , not the phone)