refactor: use built in query string instead
This commit is contained in:
parent
a84ad89d12
commit
484bc2b0e5
1 changed files with 4 additions and 10 deletions
|
|
@ -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<PaginationResult<Quotation>>(
|
||||
`/quotation?${query}`,
|
||||
);
|
||||
const res = await api.get<PaginationResult<Quotation>>(`/quotation`, {
|
||||
params,
|
||||
});
|
||||
if (res.status < 400) {
|
||||
return res.data;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue