diff --git a/src/stores/customer/index.ts b/src/stores/customer/index.ts index d920b924..38d086e5 100644 --- a/src/stores/customer/index.ts +++ b/src/stores/customer/index.ts @@ -334,9 +334,9 @@ const useCustomerStore = defineStore('api-customer', () => { transactionId?: string; }, ) { - const { id, statusSave, code, ...playload } = data; + const { id, statusSave, code, file, ...payload } = data; - const res = await api.post('/customer-branch', playload, { + const res = await api.post('/customer-branch', payload, { headers: { 'X-Session-Id': flow?.sessionId, 'X-Rtid': flow?.refTransactionId || flowStore.rtid, @@ -345,6 +345,8 @@ const useCustomerStore = defineStore('api-customer', () => { }); if (!res) return false; + if (file) await addBranchAttachment(res.data.id, { file }); + return res.data; } @@ -357,11 +359,11 @@ const useCustomerStore = defineStore('api-customer', () => { transactionId?: string; }, ) { - const { code, branchNo, ...playload } = data; + const { code, branchNo, file, ...payload } = data; const res = await api.put( `/customer-branch/${id}`, - playload, + payload, { headers: { 'X-Session-Id': flow?.sessionId, @@ -370,6 +372,9 @@ const useCustomerStore = defineStore('api-customer', () => { }, }, ); + + if (file) await addBranchAttachment(id, { file }); + if (!res) return false; return res.data;