u
This commit is contained in:
@@ -7,10 +7,22 @@ import { http } from './http.js';
|
||||
* LineInput = { sku, amount, net, tax, rebate?, comment? }
|
||||
*/
|
||||
export const quote = {
|
||||
/** GET /api/quote → { quotes: QuoteSummary[] } */
|
||||
/**
|
||||
* GET /api/quote?offset=0&limit=50&search=...&seekMonths=-1
|
||||
* @param {{ offset?: number, limit?: number, search?: string, seekMonths?: number }} [params]
|
||||
* → { quotes: QuoteSummary[], total: number, unfilteredTotal: number, offset: number, limit: number }
|
||||
*/
|
||||
// #region GET /api/quote — list
|
||||
list() {
|
||||
return http('/api/quote');
|
||||
list({ offset = 0, limit = 50, search, seekMonths } = {}) {
|
||||
const params = new URLSearchParams();
|
||||
if (offset != null) params.set('offset', String(Math.max(0, Math.floor(Number(offset) || 0))));
|
||||
if (limit != null) params.set('limit', String(Math.max(1, Math.floor(Number(limit) || 50))));
|
||||
if (search && String(search).trim()) params.set('search', String(search).trim());
|
||||
if (seekMonths != null && Number(seekMonths) < 0) {
|
||||
params.set('seekMonths', String(Math.floor(Number(seekMonths))));
|
||||
}
|
||||
const qs = params.toString();
|
||||
return http(`/api/quote${qs ? `?${qs}` : ''}`);
|
||||
},
|
||||
// #endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user