21 lines
788 B
TypeScript
21 lines
788 B
TypeScript
|
|
import { HttpClient } from '@angular/common/http';
|
||
|
|
import { Injectable } from '@angular/core';
|
||
|
|
import { Observable } from 'rxjs';
|
||
|
|
import { CONSUMER_PERMISSIONS_API_ROUTES } from '../constants';
|
||
|
|
import { IPermissionRawResponse, IPermissionRequest, IPermissionResponse } from '../models';
|
||
|
|
|
||
|
|
@Injectable({ providedIn: 'root' })
|
||
|
|
export class PermissionsService {
|
||
|
|
constructor(private http: HttpClient) {}
|
||
|
|
|
||
|
|
private apiRoutes = CONSUMER_PERMISSIONS_API_ROUTES;
|
||
|
|
|
||
|
|
getAll(accountId: string): Observable<IPermissionResponse> {
|
||
|
|
return this.http.get<IPermissionRawResponse>(this.apiRoutes.list(accountId));
|
||
|
|
}
|
||
|
|
|
||
|
|
update(accountId: string, data: IPermissionRequest): Observable<IPermissionResponse> {
|
||
|
|
return this.http.put<IPermissionResponse>(this.apiRoutes.list(accountId), data);
|
||
|
|
}
|
||
|
|
}
|