mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Fix login when there is an error
This commit is contained in:
@@ -56,13 +56,11 @@ export class LoginComponent extends FormReactive implements OnInit {
|
||||
this.authService.login(username, password).subscribe(
|
||||
result => this.router.navigate(['/videos/list']),
|
||||
|
||||
error => {
|
||||
console.error(error.json)
|
||||
|
||||
if (error.json.error === 'invalid_grant') {
|
||||
err => {
|
||||
if (err.message === 'invalid_grant') {
|
||||
this.error = 'Credentials are invalid.'
|
||||
} else {
|
||||
this.error = `${error.json.error}: ${error.json.error_description}`
|
||||
this.error = `${err.body.error_description}`
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -54,11 +54,13 @@ export class RestExtractor {
|
||||
|
||||
const errorObj = {
|
||||
message: errorMessage,
|
||||
status: undefined
|
||||
status: undefined,
|
||||
body: undefined
|
||||
}
|
||||
|
||||
if (err.status) {
|
||||
errorObj.status = err.status
|
||||
errorObj.body = err.error
|
||||
}
|
||||
|
||||
return Observable.throw(errorObj)
|
||||
|
||||
Reference in New Issue
Block a user