From 1378c0d343028f3d40d7d795422684ab9e6a1599 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Aug 2021 11:27:47 +0200 Subject: Fix client lint --- client/src/app/core/auth/auth.service.ts | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'client/src/app/core/auth/auth.service.ts') diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index ef5a3808e..5da66c981 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts @@ -80,8 +80,8 @@ export class AuthService { // Fetch the client_id/client_secret this.http.get(AuthService.BASE_CLIENT_URL) .pipe(catchError(res => this.restExtractor.handleError(res))) - .subscribe( - res => { + .subscribe({ + next: res => { this.clientId = res.client_id this.clientSecret = res.client_secret @@ -91,18 +91,18 @@ export class AuthService { console.log('Client credentials loaded.') }, - error => { - let errorMessage = error.message + error: err => { + let errorMessage = err.message - if (error.status === HttpStatusCode.FORBIDDEN_403) { - errorMessage = $localize`Cannot retrieve OAuth Client credentials: ${error.text}. + if (err.status === HttpStatusCode.FORBIDDEN_403) { + errorMessage = $localize`Cannot retrieve OAuth Client credentials: ${err.text}. Ensure you have correctly configured PeerTube (config/ directory), in particular the "webserver" section.` } // We put a bigger timeout: this is an important message this.notifier.error(errorMessage, $localize`Error`, 7000) } - ) + }) } getRefreshToken () { @@ -168,15 +168,15 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular const headers = new HttpHeaders().set('Authorization', authHeaderValue) this.http.post<{ redirectUrl?: string }>(AuthService.BASE_REVOKE_TOKEN_URL, {}, { headers }) - .subscribe( - res => { - if (res.redirectUrl) { - window.location.href = res.redirectUrl - } - }, + .subscribe({ + next: res => { + if (res.redirectUrl) { + window.location.href = res.redirectUrl + } + }, - err => console.error(err) - ) + error: err => console.error(err) + }) this.user = null @@ -215,9 +215,9 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular this.logout() this.router.navigate([ '/login' ]) - return observableThrowError({ + return observableThrowError(() => ({ error: $localize`You need to reconnect.` - }) + })) }), share() ) @@ -234,14 +234,14 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular } this.mergeUserInformation(obj) - .subscribe( - res => { + .subscribe({ + next: res => { this.user.patch(res) this.user.save() this.userInformationLoaded.next(true) } - ) + }) } private mergeUserInformation (obj: UserLoginWithUsername): Observable { -- cgit v1.2.3