feat: set image separate from update endpoints

This commit is contained in:
Methapon2001 2024-08-08 09:44:56 +07:00
parent 68838cec60
commit d9f6e1423a

View file

@ -20,6 +20,13 @@ const useCustomerStore = defineStore('api-customer', () => {
const flowStore = useFlowStore();
const data = ref<Pagination<Customer[]>>();
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,