From d9f6e1423aeb1fb7d149c2baa8f1f0b5ad3b28a5 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 8 Aug 2024 09:44:56 +0700 Subject: [PATCH] feat: set image separate from update endpoints --- src/stores/customer/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/stores/customer/index.ts b/src/stores/customer/index.ts index af89ec07..d920b924 100644 --- a/src/stores/customer/index.ts +++ b/src/stores/customer/index.ts @@ -20,6 +20,13 @@ const useCustomerStore = defineStore('api-customer', () => { const flowStore = useFlowStore(); const data = ref>(); + async function setImage(id: string, image: File) { + await api.put(`/customer/${id}/image`, image, { + headers: { 'Content-Type': image?.type }, + onUploadProgress: (e) => console.log(e), + }); + } + async function fetchById( customerId: string, flow?: { @@ -480,6 +487,7 @@ const useCustomerStore = defineStore('api-customer', () => { getStatsCustomer, + setImage, fetchListCustomeBranch, fetchById, fetchList,