import { Injectable } from '@angular/core'; import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http'; import { Observable, throwError } from 'rxjs'; import { environment } from '../../environments/environment'; @Injectable({ providedIn: 'root' }) export class VendorCreditsService { constructor(private httpClient: HttpClient) { } sendNewVendorCreditDefaultsGetRequest() { return this.httpClient.get(`${environment.apiUrl}/api/v1/vendor_credits/newVendorCreditDefaults`) } getAllVendorCreditRefundData() { return this.httpClient.get(`${environment.apiUrl}/api/v1/vendor_credits/refund`) } createVendorCreditRefund(newRefundForm) { return this.httpClient.post(`${environment.apiUrl}/api/v1/vendor_credits/refund`,newRefundForm); } createNewVendorCredit(newVendorCreditFormData) { const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; return this.httpClient.post(`${environment.apiUrl}/api/v1/vendor_credits`,newVendorCreditFormData,httpOptions) } }