1 import { catchError } from 'rxjs/operators'
2 import { HttpClient } from '@angular/common/http'
3 import { Injectable } from '@angular/core'
4 import { ScopedToken } from '@shared/models/users/user-scoped-token'
5 import { environment } from '../../../environments/environment'
6 import { RestExtractor } from '../rest'
9 export class ScopedTokensService {
10 private static BASE_SCOPED_TOKENS_URL = environment.apiUrl + '/api/v1/users/scoped-tokens'
13 private authHttp: HttpClient,
14 private restExtractor: RestExtractor
19 .get<ScopedToken>(ScopedTokensService.BASE_SCOPED_TOKENS_URL)
21 catchError(res => this.restExtractor.handleError(res))
25 renewScopedTokens () {
27 .post<ScopedToken>(ScopedTokensService.BASE_SCOPED_TOKENS_URL, {})
29 catchError(res => this.restExtractor.handleError(res))