Hi guys,
I have made some little app that should read Barcodes and send the data via API.
example:
handleBarCodeScanned = ({ type, data }) => {
alert(`Bar code with type ${type} and data ${data} has been scanned! and the phone is ${this.state.maci`);
var BarCodeScannedInApp = 'http://localhost:50474/api/ScanPart?PartBarCode=' + data + "&StationName=" + this.state.maci;
fetch(BarCodeScannedInApp)
.then(response => response.json())
.catch(error => console.log('parsing failed', error))
};
When the code trying to execute the Fetch it’s throwing an exception “parsing failed [TypeError: Network request failed]”
app.json:
{
"expo": {
"name": "my-test-scan",
"slug": "my-test-scan",
"privacy": "public",
"sdkVersion": "33.0.0",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
}
}
}
Any suggestions on how to fix this issue?
- tried to change the LocalHost to my IP with no luck.