dashboard

This commit is contained in:
Lucas Tettamanti
2026-01-27 02:41:39 -03:00
parent 493f26af17
commit df9420b954
19 changed files with 2105 additions and 111 deletions

View File

@@ -185,13 +185,23 @@ export const api = {
return fetch("/products/sync-from-woo", { method: "POST" }).then(r => r.json());
},
// --- Testing ---
async listRecentOrders({ limit = 20 } = {}) {
const u = new URL("/test/orders", location.origin);
// --- Orders & Stats ---
async listOrders({ page = 1, limit = 50 } = {}) {
const u = new URL("/api/orders", location.origin);
u.searchParams.set("page", String(page));
u.searchParams.set("limit", String(limit));
return fetch(u).then(r => r.json());
},
async getOrderStats() {
return fetch("/api/stats/orders").then(r => r.json());
},
// Alias para compatibilidad
async listRecentOrders({ limit = 20 } = {}) {
return this.listOrders({ page: 1, limit });
},
async getProductsWithStock() {
return fetch("/test/products-with-stock").then(r => r.json());
},