Files
tehran_tala/apps/user-app/dist/assets/client-CJxy5iKa.js
T
2026-09-21 08:32:31 +03:30

2 lines
690 B
JavaScript

const a="/api";async function t(e,s){const r=await fetch(`${a}${e}`,{headers:{"Content-Type":"application/json"},...s});if(!r.ok){const o=await r.text();throw new Error(`API ${e} failed (${r.status}): ${o}`)}return r.json()}const c={listProducts:()=>t("/catalog/products"),listCustomers:()=>t("/customers"),getCustomer:e=>t(`/customers/${e}`),getBalance:e=>t(`/accounting/customers/${e}/balance`),getLedgerEntries:e=>t(`/customers/${e}/ledger-entries`),createOrder:e=>t("/orders",{method:"POST",body:JSON.stringify(e)}),getCustomerOrders:e=>t(`/customers/${e}/orders`),getLatestGoldPrice:(e=750)=>t(`/pricing/latest?karatPerMille=${e}`),getHomeSlider:()=>t("/home/slider")};export{c as a};