Files
brewman/overlord/src/app/purchase-entries/purchase-entries.service.ts
T
tanshu cb2b650375 Moved to Angular v20 and Tailwind v4 plus all related dependencies
Renamed Docker directory.

Also serving static files from FastAPI.
2025-06-26 06:46:17 +00:00

27 lines
1000 B
TypeScript

import { HttpClient } from '@angular/common/http';
import { inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs/internal/Observable';
import { catchError } from 'rxjs/operators';
import { ErrorLoggerService } from '../core/error-logger.service';
import { PurchaseEntries } from './purchase-entries';
const url = '/api/purchase-entries';
const serviceName = 'PurchaseEntriesService';
@Injectable({
providedIn: 'root',
})
export class PurchaseEntriesService {
private http = inject(HttpClient);
private log = inject(ErrorLoggerService);
list(startDate: string | null, finishDate: string | null): Observable<PurchaseEntries> {
const startDateWithSlash = startDate ? `/${startDate}` : '';
const finishDateWithSlash = finishDate ? `/${finishDate}` : '';
return this.http
.get<PurchaseEntries>(`${url}${startDateWithSlash}${finishDateWithSlash}`)
.pipe(catchError(this.log.handleError(serviceName, 'list'))) as Observable<PurchaseEntries>;
}
}