File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed 
src/app/modules/auth/pages/log-in-page Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ import { RoutesConfig } from '~app/configs/routes.config';
77import  {  Router  }  from  '@angular/router' ; 
88import  {  UtilsService  }  from  '~shared/services/utils.service' ; 
99
10+ export  enum  UserLoginError  { 
11+   BAD_USER_INPUT  =  'BAD_USER_INPUT' , 
12+ } 
13+ 
1014@Component ( { 
1115  selector : 'app-log-in-page' , 
1216  templateUrl : './log-in-page.component.html' , 
@@ -58,8 +62,8 @@ export class LogInPageComponent {
5862      this . authService . logIn ( formValue . email ,  formValue . password ) . subscribe ( ( response : any )  =>  { 
5963        if  ( ! response . errors )  { 
6064          this . router . navigate ( [ RoutesConfig . routes . hero . myHeroes ] ) ; 
61-         }  else  if  ( response . errors [ 0 ] . code  ===  11000 )  { 
62-           this . utilsService . showSnackBar ( "Nice! Let's create some heroes" ,  'info-snack-bar' ) ; 
65+         }  else  if  ( response . errors [ 0 ] . extensions ?. code  ===  UserLoginError . BAD_USER_INPUT )  { 
66+           this . utilsService . showSnackBar ( 'Bad credentials!' ,  'info-snack-bar' ) ; 
6367        } 
6468      } ) ; 
6569    } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments