feat(purchase-list): implement loading skeleton and enhance purchase list fetching logic

This commit is contained in:
2026-07-08 11:31:52 -03:00
parent 23f48ccec0
commit b016569b10
4 changed files with 130 additions and 13 deletions

View File

@@ -62,6 +62,20 @@ export class CheckoutService {
};
}
async getPurchases(tenantCode: string, status?: string): Promise<{ data: any[] }> {
let url = `${environment.url}tenants/${tenantCode}/compras`;
if (status) {
url += `?status=${status}`;
}
const response = await firstValueFrom(
this.http.get<{ data: any[] }>(url)
);
if (!response) {
throw new Error('Error al obtener las compras.');
}
return response;
}
async getPurchase(tenantCode: string, purchaseId: string | number): Promise<PurchaseStatusResponse> {
const response = await firstValueFrom(
this.http.get<{ data?: PurchaseStatusResponse } | PurchaseStatusResponse>(`${environment.url}tenants/${tenantCode}/compras/${purchaseId}`)