feat: add api get method function

This commit is contained in:
Methapon2001 2024-08-07 17:55:35 +07:00
parent 1134ca5210
commit 301dcc32aa

View file

@ -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<CustomerBranch>(`/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,