From 301dcc32aa9e957d0c4dbd22dfdf2baa366b6156 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:55:35 +0700 Subject: [PATCH] feat: add api get method function --- src/stores/customer/index.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/stores/customer/index.ts b/src/stores/customer/index.ts index 4f273502..af89ec07 100644 --- a/src/stores/customer/index.ts +++ b/src/stores/customer/index.ts @@ -299,6 +299,26 @@ const useCustomerStore = defineStore('api-customer', () => { return false; } + async function getBranchById( + id: string, + flow?: { + sessionId?: string; + refTransactionId?: string; + transactionId?: string; + }, + ) { + const res = await api.post(`/customer-branch/${id}`, { + headers: { + 'X-Session-Id': flow?.sessionId, + 'X-Rtid': flow?.refTransactionId || flowStore.rtid, + 'X-Tid': flow?.transactionId, + }, + }); + if (!res) return false; + + return res.data; + } + async function createBranch( data: CustomerBranchCreate & { customerId: string }, flow?: { @@ -467,6 +487,7 @@ const useCustomerStore = defineStore('api-customer', () => { editById, deleteById, createBranch, + getBranchById, editBranchById, deleteBranchById, fetchListCustomeBranchById,