feat(purchase-list): implement loading skeleton and enhance purchase list fetching logic
This commit is contained in:
@@ -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}`)
|
||||
|
||||
Reference in New Issue
Block a user