I’m having trouble running an HttpClient GET function after a successful scan of a barcode. The barcode scanning is working but when I pass the barcode value to my get function nothing happens. I’m using async and await but must be missing something.
My HTTP GET function:
getOrderFromShopify(requestUrl: any) {
this.http.get(requestUrl)
.subscribe(data => {
console.log(data);
this.order_details = data["order"];
this.line_items = data["order"]["line_items"];
})
}
My Barcode Scan function:
async scanCode() {
this.barcodeScanner
.scan()
.then(async barcodeData => {
const baseURL = 'https://xxxxxxx.xxx?';
const queryOptions = 'order_name=' + barcodeData.text; //Keep going
let requestUrl = `${baseURL}${queryOptions}`;
await this.getOrderFromShopify(requestUrl);
this.scannedData = barcodeData;
})
.catch(err => {
console.log("Error", err);
});
}
1 post - 1 participant