commit de compras

This commit is contained in:
2026-11-04 09:37:20 +02:00
parent fcf31e8d48
commit 0b05a1192c
741 changed files with 114127 additions and 116 deletions
+9
View File
@@ -0,0 +1,9 @@
/** One cancellable read: a late response cannot replace another period or context. */
export function requestStockPeriod({query,api,data,error,loading}) {
let cancelled=false;
data(null);error('');loading(true);
const params=new URLSearchParams(Object.entries(query).filter(([,value])=>value!==undefined&&value!==''));
Promise.resolve().then(()=>api('/api/stock-read?'+params)).then(value=>{if(!cancelled)data(value);})
.catch(e=>{if(!cancelled)error(e.message);}).finally(()=>{if(!cancelled)loading(false);});
return ()=>{cancelled=true;};
}