Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async componentDidMount() {
try {
const info = await Purchases.getPurchaserInfo();
this.handleInfo(info);
} catch (e) {
// eslint-disable-next-line no-console
console.log("Error handling");
}
}
async componentDidMount() {
Purchases.setDebugLogsEnabled(true);
Purchases.setup("api_key");
try {
const purchaserInfo = await Purchases.getPurchaserInfo();
if (typeof purchaserInfo.entitlements.active.pro_cat !== "undefined") {
this.setState({
load: "Cats",
loading: false
});
} else {
this.setState({
load: "Upsell",
loading: false
});
}
} catch (e) {
// eslint-disable-next-line no-console
console.log(`Error ${JSON.stringify(e)}`);
}
}
export const latestExpirationDate = async (): Promise => {
const purchaserInfo = await Purchases.getPurchaserInfo();
return purchaserInfo.latestExpirationDate;
};