refactor: wait putAttachment

This commit is contained in:
Net 2024-08-28 09:51:12 +07:00 committed by Methapon Metanipat
parent 57a32bdd04
commit 53c015ae6c

View file

@ -2684,25 +2684,32 @@ const emptyCreateDialog = ref(false);
}
customerFormData.customerBranch[idx].file?.forEach(
(v) => {
async (v) => {
if (!v.file) return;
const ext = v.file.name.split('.').at(-1);
let filename = v.group + '-' + new Date().getTime();
if (ext) filename += `.${ext}`;
customerStore.putAttachment({
const res = await customerStore.putAttachment({
branchId:
customerFormData.customerBranch?.[idx].id || '',
file: v.file,
filename,
});
if (res) {
await customerFormStore.assignFormData(
customerFormState.editCustomerId,
);
}
},
);
await customerFormStore.assignFormData(
customerFormState.editCustomerId,
);
customerFormStore.resetForm();
}
}