Use server error message on login
authorChocobozzz <me@florianbigard.com>
Fri, 29 Dec 2017 08:22:23 +0000 (09:22 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 29 Dec 2017 08:22:23 +0000 (09:22 +0100)
client/src/app/login/login.component.ts

index dfede592478046d01872248491f53d74cd28de5f..e7c9c722632a3dfdb6504a7705ea5fe3c65a7513 100644 (file)
@@ -55,15 +55,9 @@ export class LoginComponent extends FormReactive implements OnInit {
     const { username, password } = this.form.value
 
     this.authService.login(username, password).subscribe(
-      result => this.router.navigate(['/videos/list']),
+      () => this.router.navigate(['/videos/list']),
 
-      err => {
-        if (err.message === 'invalid_grant') {
-          this.error = 'Credentials are invalid.'
-        } else {
-          this.error = `${err.body.error_description}`
-        }
-      }
+      err => this.error = err.message
     )
   }
 }