From ceb39828ee690788999ce97c4b73224d671d0551 Mon Sep 17 00:00:00 2001 From: Net <93821485+somnetsak123@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:57:01 +0700 Subject: [PATCH] =?UTF-8?q?fix:=E0=B9=81=E0=B8=81=E0=B9=89=20editById=20?= =?UTF-8?q?=E0=B9=83=E0=B8=AB=E0=B9=89=20=20=E0=B9=81=E0=B8=81=E0=B9=89?= =?UTF-8?q?=E0=B9=84=E0=B8=82=E0=B8=A3=E0=B8=B9=E0=B8=9B=E0=B9=84=E0=B8=94?= =?UTF-8?q?=E0=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/branch/index.ts | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/stores/branch/index.ts b/src/stores/branch/index.ts index 4a851ba2..da27c519 100644 --- a/src/stores/branch/index.ts +++ b/src/stores/branch/index.ts @@ -150,20 +150,35 @@ const useBranchStore = defineStore('api-branch', () => { async function editById( id: string, - branch: Partial, + data: Partial, + qrCodeImage?: File, flow?: { sessionId: string; refTransactionId: string; transactionId: string; }, ) { - const res = await api.put(`/branch/${id}`, branch, { - headers: { - 'X-Session-Id': flow?.sessionId, - 'X-Rtid': flow?.refTransactionId, - 'X-Tid': flow?.transactionId, + const { ...payload } = data; + const res = await api.put( + `/branch/${id}`, + payload, + { + headers: { + 'X-Session-Id': flow?.sessionId, + 'X-Rtid': flow?.refTransactionId, + 'X-Tid': flow?.transactionId, + }, }, - }); + ); + + if (qrCodeImage) { + await axios + .put(res.data.qrCodeImageUploadUrl, qrCodeImage, { + headers: { 'Content-Type': qrCodeImage.type }, + onUploadProgress: (e) => console.log(e), + }) + .catch((e) => console.error(e)); + } if (!res) return false;