blob: 038e5031c6b79ae3499e17633e379856a5d8bfbc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import { catchError } from 'rxjs/operators'
import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { ScopedToken } from '@shared/models/users/user-scoped-token'
import { environment } from '../../../environments/environment'
import { RestExtractor } from '../rest'
@Injectable()
export class ScopedTokensService {
private static BASE_SCOPED_TOKENS_URL = environment.apiUrl + '/api/v1/users/scoped-tokens'
constructor (
private authHttp: HttpClient,
private restExtractor: RestExtractor
) {}
getScopedTokens () {
return this.authHttp
.get<ScopedToken>(ScopedTokensService.BASE_SCOPED_TOKENS_URL)
.pipe(
catchError(res => this.restExtractor.handleError(res))
)
}
renewScopedTokens () {
return this.authHttp
.post<ScopedToken>(ScopedTokensService.BASE_SCOPED_TOKENS_URL, {})
.pipe(
catchError(res => this.restExtractor.handleError(res))
)
}
}
|