Can anyone explain if I am doing this correctly?
It seems to work fine on Android, but on IOS it takes at least 10 seconds for the Apple confirm dialogue to appear, and then after confirming purchase (in sandbox) it then pops up again and never gets to the alert and redirection?
```
useEffect(() => {
(async function () {
await Purchases.setLogLevel({ level: LOG_LEVEL.INFO }); // Enable to get debug logs
await Purchases.configure({
apiKey: "XXX"
});
})();
}, ]);
const purchaseStoreProductA = async () => {
const offerings = await Purchases.getOfferings();
const productToBuy = offerings.current
&& offerings.current.availablePackages
&& offerings.current.availablePackagese0].product;
if (productToBuy == null) {
alert('No product');
return
};
const purchaseResult = await Purchases.purchaseStoreProduct({
product: productToBuy
});
purchaseResult ? alert('Thank you for subscribing.') + history.push("/ios-signup/") : null;
}
```
I call purchaseStoreProductA() from a button.