diff --git a/app/views/LoginView/handleLoginErrors.ts b/app/views/LoginView/handleLoginErrors.ts index 37f1b2080c..5e352b2864 100644 --- a/app/views/LoginView/handleLoginErrors.ts +++ b/app/views/LoginView/handleLoginErrors.ts @@ -26,10 +26,12 @@ const LOGIN_SUBMIT_ERRORS = { }; export const handleLoginErrors = (error: keyof typeof LOGIN_SUBMIT_ERRORS): string => { - const errorKey = Object.keys(LOGIN_SUBMIT_ERRORS).find(key => error.includes(key)) as keyof typeof LOGIN_SUBMIT_ERRORS; - const e = errorKey ? LOGIN_SUBMIT_ERRORS[errorKey].i18n : 'Login_error'; - if (i18n.isTranslated(e)) { - return i18n.t(e); + if (typeof error === 'string') { + const errorKey = Object.keys(LOGIN_SUBMIT_ERRORS).find(key => error?.includes(key)) as keyof typeof LOGIN_SUBMIT_ERRORS; + const e = errorKey ? LOGIN_SUBMIT_ERRORS[errorKey]?.i18n : 'Login_error'; + if (i18n.isTranslated(e)) { + return i18n.t(e); + } } return i18n.t('Login_error'); };