[FIX] Register crashing when error data is undefined (#2256)

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Djorkaeff Alexandre 2020-07-08 13:52:20 -03:00 committed by GitHub
parent ef68f1644a
commit ea10693c40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -145,10 +145,12 @@ class RegisterView extends React.Component {
await loginRequest({ user: email, password });
}
} catch (e) {
if (e.data && e.data.errorType === 'username-invalid') {
if (e.data?.errorType === 'username-invalid') {
return loginRequest({ user: email, password });
}
showErrorAlert(e.data.error, I18n.t('Oops'));
if (e.data?.error) {
showErrorAlert(e.data.error, I18n.t('Oops'));
}
}
this.setState({ saving: false });
}