From 484bc2b0e52cd4e037c79d8e685ee288d7e86ca0 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Thu, 24 Oct 2024 16:37:05 +0700 Subject: [PATCH] refactor: use built in query string instead --- src/stores/quotations/index.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/stores/quotations/index.ts b/src/stores/quotations/index.ts index d5a54891..c434b677 100644 --- a/src/stores/quotations/index.ts +++ b/src/stores/quotations/index.ts @@ -44,21 +44,15 @@ export const useQuotationStore = defineStore('quotation-store', () => { return null; } - async function getQuotationList(opts?: { + async function getQuotationList(params?: { page?: number; pageSize?: number; payCondition?: 'Full' | 'Split' | 'BillFull' | 'BillSplit'; query?: string; }) { - const params = new URLSearchParams(); - for (const [k, v] of Object.entries(opts || {})) { - if (v !== undefined) params.append(k, v.toString()); - } - const query = params.toString(); - - const res = await api.get>( - `/quotation?${query}`, - ); + const res = await api.get>(`/quotation`, { + params, + }); if (res.status < 400) { return res.data; }