diff options
Diffstat (limited to 'client/src/app/core/auth/auth.service.ts')
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 40 |
1 files changed, 20 insertions, 20 deletions
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 { | |||
80 | // Fetch the client_id/client_secret | 80 | // Fetch the client_id/client_secret |
81 | this.http.get<OAuthClientLocal>(AuthService.BASE_CLIENT_URL) | 81 | this.http.get<OAuthClientLocal>(AuthService.BASE_CLIENT_URL) |
82 | .pipe(catchError(res => this.restExtractor.handleError(res))) | 82 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
83 | .subscribe( | 83 | .subscribe({ |
84 | res => { | 84 | next: res => { |
85 | this.clientId = res.client_id | 85 | this.clientId = res.client_id |
86 | this.clientSecret = res.client_secret | 86 | this.clientSecret = res.client_secret |
87 | 87 | ||
@@ -91,18 +91,18 @@ export class AuthService { | |||
91 | console.log('Client credentials loaded.') | 91 | console.log('Client credentials loaded.') |
92 | }, | 92 | }, |
93 | 93 | ||
94 | error => { | 94 | error: err => { |
95 | let errorMessage = error.message | 95 | let errorMessage = err.message |
96 | 96 | ||
97 | if (error.status === HttpStatusCode.FORBIDDEN_403) { | 97 | if (err.status === HttpStatusCode.FORBIDDEN_403) { |
98 | errorMessage = $localize`Cannot retrieve OAuth Client credentials: ${error.text}. | 98 | errorMessage = $localize`Cannot retrieve OAuth Client credentials: ${err.text}. |
99 | Ensure you have correctly configured PeerTube (config/ directory), in particular the "webserver" section.` | 99 | Ensure you have correctly configured PeerTube (config/ directory), in particular the "webserver" section.` |
100 | } | 100 | } |
101 | 101 | ||
102 | // We put a bigger timeout: this is an important message | 102 | // We put a bigger timeout: this is an important message |
103 | this.notifier.error(errorMessage, $localize`Error`, 7000) | 103 | this.notifier.error(errorMessage, $localize`Error`, 7000) |
104 | } | 104 | } |
105 | ) | 105 | }) |
106 | } | 106 | } |
107 | 107 | ||
108 | getRefreshToken () { | 108 | getRefreshToken () { |
@@ -168,15 +168,15 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular | |||
168 | const headers = new HttpHeaders().set('Authorization', authHeaderValue) | 168 | const headers = new HttpHeaders().set('Authorization', authHeaderValue) |
169 | 169 | ||
170 | this.http.post<{ redirectUrl?: string }>(AuthService.BASE_REVOKE_TOKEN_URL, {}, { headers }) | 170 | this.http.post<{ redirectUrl?: string }>(AuthService.BASE_REVOKE_TOKEN_URL, {}, { headers }) |
171 | .subscribe( | 171 | .subscribe({ |
172 | res => { | 172 | next: res => { |
173 | if (res.redirectUrl) { | 173 | if (res.redirectUrl) { |
174 | window.location.href = res.redirectUrl | 174 | window.location.href = res.redirectUrl |
175 | } | 175 | } |
176 | }, | 176 | }, |
177 | 177 | ||
178 | err => console.error(err) | 178 | error: err => console.error(err) |
179 | ) | 179 | }) |
180 | 180 | ||
181 | this.user = null | 181 | this.user = null |
182 | 182 | ||
@@ -215,9 +215,9 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular | |||
215 | this.logout() | 215 | this.logout() |
216 | this.router.navigate([ '/login' ]) | 216 | this.router.navigate([ '/login' ]) |
217 | 217 | ||
218 | return observableThrowError({ | 218 | return observableThrowError(() => ({ |
219 | error: $localize`You need to reconnect.` | 219 | error: $localize`You need to reconnect.` |
220 | }) | 220 | })) |
221 | }), | 221 | }), |
222 | share() | 222 | share() |
223 | ) | 223 | ) |
@@ -234,14 +234,14 @@ Ensure you have correctly configured PeerTube (config/ directory), in particular | |||
234 | } | 234 | } |
235 | 235 | ||
236 | this.mergeUserInformation(obj) | 236 | this.mergeUserInformation(obj) |
237 | .subscribe( | 237 | .subscribe({ |
238 | res => { | 238 | next: res => { |
239 | this.user.patch(res) | 239 | this.user.patch(res) |
240 | this.user.save() | 240 | this.user.save() |
241 | 241 | ||
242 | this.userInformationLoaded.next(true) | 242 | this.userInformationLoaded.next(true) |
243 | } | 243 | } |
244 | ) | 244 | }) |
245 | } | 245 | } |
246 | 246 | ||
247 | private mergeUserInformation (obj: UserLoginWithUsername): Observable<UserLoginWithUserInformation> { | 247 | private mergeUserInformation (obj: UserLoginWithUsername): Observable<UserLoginWithUserInformation> { |