Commit 2c0cfa1 1 parent 2f4bde7 commit 2c0cfa1 Copy full SHA for 2c0cfa1
File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,12 @@ const LOGIN_SUBMIT_ERRORS = {
26
26
} ;
27
27
28
28
export const handleLoginErrors = ( error : keyof typeof LOGIN_SUBMIT_ERRORS ) : string => {
29
- const errorKey = Object . keys ( LOGIN_SUBMIT_ERRORS ) . find ( key => error . includes ( key ) ) as keyof typeof LOGIN_SUBMIT_ERRORS ;
30
- const e = errorKey ? LOGIN_SUBMIT_ERRORS [ errorKey ] . i18n : 'Login_error' ;
31
- if ( i18n . isTranslated ( e ) ) {
32
- return i18n . t ( e ) ;
29
+ if ( typeof error === 'string' ) {
30
+ const errorKey = Object . keys ( LOGIN_SUBMIT_ERRORS ) . find ( key => error ?. includes ( key ) ) as keyof typeof LOGIN_SUBMIT_ERRORS ;
31
+ const e = errorKey ? LOGIN_SUBMIT_ERRORS [ errorKey ] ?. i18n : 'Login_error' ;
32
+ if ( i18n . isTranslated ( e ) ) {
33
+ return i18n . t ( e ) ;
34
+ }
33
35
}
34
36
return i18n . t ( 'Login_error' ) ;
35
37
} ;
You can’t perform that action at this time.
0 commit comments