using translations on sc2 login failure

This commit is contained in:
noumantahir 2023-06-17 21:41:01 +05:00
parent fdfeb74fc2
commit abed24b4e8
2 changed files with 16 additions and 15 deletions

View File

@ -147,8 +147,9 @@ class LoginContainer extends PureComponent {
})
.catch((error) => {
this.setState({ isLoading: false });
Alert.alert('Error', intl.formatMessage({ id: error.message }));
// TODO: return
Alert.alert(
intl.formatMessage({ id: 'alert.fail' }),
intl.formatMessage({ id: error.message }));
});
};
@ -195,8 +196,8 @@ class LoginContainer extends PureComponent {
const errorDescription = err?.response?.data?.error_description
? err?.response?.data?.error_description
: intl.formatMessage({
id: err.message,
});
id: err.message,
});
Alert.alert(
intl.formatMessage({
id: 'login.login_failed',

View File

@ -65,17 +65,18 @@ class HiveSigner extends PureComponent {
});
}
} else {
// TODO: Error alert (Toast Message)
throw new Error('alert.unknow_error')
}
})
.catch((error) => {
Alert.alert(
'Error',
// intl.formatMessage({ id:
error.message || error.toString(),
// }),
intl.formatMessage({ id: 'alert.fail' }),
intl.formatMessage({
id:
error.message,
}),
);
// TODO: return
});
}
}
@ -87,11 +88,10 @@ class HiveSigner extends PureComponent {
<StatusBar hidden translucent />
<WebView
source={{
uri: `${hsOptions.base_url}oauth2/authorize?client_id=${
hsOptions.client_id
}&redirect_uri=${encodeURIComponent(
hsOptions.redirect_uri,
)}&response_type=code&scope=${encodeURIComponent(hsOptions.scope)}`,
uri: `${hsOptions.base_url}oauth2/authorize?client_id=${hsOptions.client_id
}&redirect_uri=${encodeURIComponent(
hsOptions.redirect_uri,
)}&response_type=code&scope=${encodeURIComponent(hsOptions.scope)}`,
}}
onNavigationStateChange={this._onNavigationStateChange}
ref={(ref) => {