diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-15 11:55:51 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-16 09:42:54 +0200 |
commit | db400f447a9f7aae1c56fa25396e93069744483f (patch) | |
tree | f45af832a5d3f4eebafd2f885b7413d9f84fa374 /client/src/app/shared/account | |
parent | 54c3a22faa04bf13eea37f39be9149fc5eb95737 (diff) | |
download | PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.tar.gz PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.tar.zst PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.zip |
Upgrade to rxjs 6
Diffstat (limited to 'client/src/app/shared/account')
-rw-r--r-- | client/src/app/shared/account/account.service.ts | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/client/src/app/shared/account/account.service.ts b/client/src/app/shared/account/account.service.ts index 8c66ae04a..20e52d946 100644 --- a/client/src/app/shared/account/account.service.ts +++ b/client/src/app/shared/account/account.service.ts | |||
@@ -1,14 +1,11 @@ | |||
1 | import { map, tap, catchError } from 'rxjs/operators' | ||
1 | import { Injectable } from '@angular/core' | 2 | import { Injectable } from '@angular/core' |
2 | import 'rxjs/add/operator/catch' | ||
3 | import 'rxjs/add/operator/map' | ||
4 | import { environment } from '../../../environments/environment' | 3 | import { environment } from '../../../environments/environment' |
5 | import { Observable } from 'rxjs/Observable' | 4 | import { Observable, ReplaySubject } from 'rxjs' |
6 | import { Account } from '@app/shared/account/account.model' | 5 | import { Account } from '@app/shared/account/account.model' |
7 | import { RestExtractor } from '@app/shared/rest/rest-extractor.service' | 6 | import { RestExtractor } from '@app/shared/rest/rest-extractor.service' |
8 | import { RestService } from '@app/shared/rest/rest.service' | ||
9 | import { HttpClient } from '@angular/common/http' | 7 | import { HttpClient } from '@angular/common/http' |
10 | import { Account as ServerAccount } from '../../../../../shared/models/actors/account.model' | 8 | import { Account as ServerAccount } from '../../../../../shared/models/actors/account.model' |
11 | import { ReplaySubject } from 'rxjs/ReplaySubject' | ||
12 | 9 | ||
13 | @Injectable() | 10 | @Injectable() |
14 | export class AccountService { | 11 | export class AccountService { |
@@ -18,14 +15,15 @@ export class AccountService { | |||
18 | 15 | ||
19 | constructor ( | 16 | constructor ( |
20 | private authHttp: HttpClient, | 17 | private authHttp: HttpClient, |
21 | private restExtractor: RestExtractor, | 18 | private restExtractor: RestExtractor |
22 | private restService: RestService | ||
23 | ) {} | 19 | ) {} |
24 | 20 | ||
25 | getAccount (id: number): Observable<Account> { | 21 | getAccount (id: number): Observable<Account> { |
26 | return this.authHttp.get<ServerAccount>(AccountService.BASE_ACCOUNT_URL + id) | 22 | return this.authHttp.get<ServerAccount>(AccountService.BASE_ACCOUNT_URL + id) |
27 | .map(accountHash => new Account(accountHash)) | 23 | .pipe( |
28 | .do(account => this.accountLoaded.next(account)) | 24 | map(accountHash => new Account(accountHash)), |
29 | .catch((res) => this.restExtractor.handleError(res)) | 25 | tap(account => this.accountLoaded.next(account)), |
26 | catchError(res => this.restExtractor.handleError(res)) | ||
27 | ) | ||
30 | } | 28 | } |
31 | } | 29 | } |