-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PB-1678]:Fix/Update wrong login credentials text #1300
base: release/2.7.0
Are you sure you want to change the base?
[PB-1678]:Fix/Update wrong login credentials text #1300
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -172,7 +172,11 @@ export default function LogIn(): JSX.Element { | |||
navigationService.history.push(`/activate/${email}`); | |||
} | |||
|
|||
setLoginError([castedError.message]); | |||
setLoginError([ | |||
castedError.message.includes('Wrong login credentials') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of comparing the error message to display that message, I think that will be bettter try doing it with the http status code. That way even if the backend change the message it will still work if the numerical code is the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed!
@@ -172,7 +172,7 @@ export default function LogIn(): JSX.Element { | |||
navigationService.history.push(`/activate/${email}`); | |||
} | |||
|
|||
setLoginError([castedError.message]); | |||
setLoginError([(err as AppError)?.status === 401 ? translate('auth.login.wrongLogin') : castedError.message]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can extract this conditional out of the setState. E.g.:
const UNAUTHORIZED_STATUS_CODE = 401;
function getLoginErrorMessage(err: unknown): string {
const appError = err as AppError;
if (appError?.status === UNAUTHORIZED_STATUS_CODE) {
return translate('auth.login.wrongLogin');
}
return appError?.message || 'An unexpected error occurred';
}
setLoginError([getLoginErrorMessage(err)])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Done!
Quality Gate passedIssues Measures |
Update wrong login text and transaltions