Files
psp_panel/src/app/domains/partner/modules/consumers/services/licenses.service.ts
T

25 lines
843 B
TypeScript
Raw Normal View History

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { CONSUMER_LICENSES_API_ROUTES } from '../constants';
import { ILicenseRawResponse, ILicenseRequest, ILicenseResponse } from '../models';
@Injectable({ providedIn: 'root' })
export class LicensesService {
constructor(private http: HttpClient) {}
private apiRoutes = CONSUMER_LICENSES_API_ROUTES;
create(consumerId: string, data: ILicenseRequest): Observable<ILicenseResponse> {
return this.http.post<ILicenseRawResponse>(this.apiRoutes.list(consumerId), data);
}
update(
consumerId: string,
licenseId: string,
data: ILicenseRequest,
): Observable<ILicenseResponse> {
return this.http.patch<ILicenseRawResponse>(this.apiRoutes.single(consumerId, licenseId), data);
}
}