Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async authorize(navigation) {
const authCode = navigation.getParam('authCode', '');
if (!authCode) {
Alert.alert('Error: empty auth code');
navigation.goBack();
return;
}
try {
await authorizeAsync(authCode);
this.props.navigation.navigate('Checkout');
} catch (ex) {
let errorMessage = ex.message;
switch (ex.code) {
case AuthorizeErrorNoNetwork:
// Remind connecting to network and retry
Alert.alert(
'Network error',
ex.message,
[
{ text: 'Retry', onPress: () => this.authorize(navigation) },
{ text: 'Cancel', onPress: () => navigation.navigate('Authorize'), style: 'cancel' },
],
);
break;
case UsageError: