aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/account
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/account')
-rw-r--r--client/src/app/shared/account/account.service.ts18
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 @@
1import { map, tap, catchError } from 'rxjs/operators'
1import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
2import 'rxjs/add/operator/catch'
3import 'rxjs/add/operator/map'
4import { environment } from '../../../environments/environment' 3import { environment } from '../../../environments/environment'
5import { Observable } from 'rxjs/Observable' 4import { Observable, ReplaySubject } from 'rxjs'
6import { Account } from '@app/shared/account/account.model' 5import { Account } from '@app/shared/account/account.model'
7import { RestExtractor } from '@app/shared/rest/rest-extractor.service' 6import { RestExtractor } from '@app/shared/rest/rest-extractor.service'
8import { RestService } from '@app/shared/rest/rest.service'
9import { HttpClient } from '@angular/common/http' 7import { HttpClient } from '@angular/common/http'
10import { Account as ServerAccount } from '../../../../../shared/models/actors/account.model' 8import { Account as ServerAccount } from '../../../../../shared/models/actors/account.model'
11import { ReplaySubject } from 'rxjs/ReplaySubject'
12 9
13@Injectable() 10@Injectable()
14export class AccountService { 11export 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}