From 0c3eeef35ef0a8e3d0a86f47025fa5a8a276fb9e Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Tue, 29 Oct 2024 08:49:27 +0700 Subject: [PATCH] feat: add params --- src/stores/employee/index.ts | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/stores/employee/index.ts b/src/stores/employee/index.ts index 5e34d0f0..034d2225 100644 --- a/src/stores/employee/index.ts +++ b/src/stores/employee/index.ts @@ -46,23 +46,14 @@ const useEmployeeStore = defineStore('api-employee', () => { query?: string; gender?: string; status?: Status; + passport?: boolean; + visa: boolean; zipCode?: string; customerId?: string; }) { - const params = new URLSearchParams(); - - for (const [k, v] of Object.entries(opts || {})) { - v !== undefined && params.append(k, v.toString()); - } - - const query = params.toString(); - - const res = await api.get>( - `/employee${(params && '?'.concat(query)) || ''}`, - { - headers: { 'X-Rtid': flowStore.rtid }, - }, - ); + const res = await api.get>(`/employee`, { + params: opts, + }); if (res && res.status === 200) { data.value = res.data;