productos, equivalencias, cross-sell y cantidades
This commit is contained in:
@@ -137,6 +137,11 @@ export const api = {
|
||||
return fetch(u).then(r => r.json());
|
||||
},
|
||||
|
||||
async getRecommendation(id) {
|
||||
if (!id) return null;
|
||||
return fetch(`/recommendations/${encodeURIComponent(id)}`).then(r => r.json());
|
||||
},
|
||||
|
||||
async createRecommendation(data) {
|
||||
return fetch("/recommendations", {
|
||||
method: "POST",
|
||||
@@ -156,4 +161,22 @@ export const api = {
|
||||
async deleteRecommendation(id) {
|
||||
return fetch(`/recommendations/${encodeURIComponent(id)}`, { method: "DELETE" }).then(r => r.json());
|
||||
},
|
||||
|
||||
// Quantities (cantidades por producto/evento/persona)
|
||||
async listQuantities() {
|
||||
return fetch("/quantities").then(r => r.json());
|
||||
},
|
||||
|
||||
async getProductQuantities(wooProductId) {
|
||||
if (!wooProductId) return { rules: [] };
|
||||
return fetch(`/quantities/${encodeURIComponent(wooProductId)}`).then(r => r.json());
|
||||
},
|
||||
|
||||
async saveProductQuantities(wooProductId, rules) {
|
||||
return fetch(`/quantities/${encodeURIComponent(wooProductId)}`, {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ rules }),
|
||||
}).then(r => r.json());
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user