diff --git a/src/stores/customer/index.ts b/src/stores/customer/index.ts index b0a2f17f..45947074 100644 --- a/src/stores/customer/index.ts +++ b/src/stores/customer/index.ts @@ -240,7 +240,7 @@ const useCustomerStore = defineStore('api-customer', () => { async function create( data: CustomerCreate, - imgList: { + imgList?: { selectedImage: string; list: { url: string; imgFile: File | null; name: string }[]; }, @@ -277,11 +277,11 @@ const useCustomerStore = defineStore('api-customer', () => { customerId: undefined, codeCustomer: undefined, })), - selectedImage: imgList.selectedImage, + selectedImage: imgList?.selectedImage, }, ); - if (imgList.list.length > 0 && res.data.id) { + if (imgList && imgList.list.length > 0 && res.data.id) { for (let index = 0; index < imgList.list.length; index++) { const imgFile = imgList.list[index].imgFile; if (imgFile)