From 6090a1a4b0fb45bf5ed0b34c995162ac3384216b Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:47:50 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20getStatsEmployeeGender=20=E0=B8=A3?= =?UTF-8?q?=E0=B8=B1=E0=B8=9A=20opts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/employee/index.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/stores/employee/index.ts b/src/stores/employee/index.ts index e0530176..471a9db1 100644 --- a/src/stores/employee/index.ts +++ b/src/stores/employee/index.ts @@ -234,15 +234,28 @@ const useEmployeeStore = defineStore('api-employee', () => { } async function getStatsEmployeeGender( - customerBranchId?: string, + opts?: { + customerBranchId?: string; + status?: 'CREATED' | 'ACTIVE' | 'INACTIVE'; + query?: string; + }, + flow?: { sessionId?: string; refTransactionId?: string; transactionId?: 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/stats/gender${customerBranchId ? '?customerBranchId=' + customerBranchId : ''}/`, + `/employee/stats/gender${(params && '?'.concat(query)) || ''}`, { headers: { 'X-Session-Id': flow?.sessionId,