diff options
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 | } |