refactor: edit get value

This commit is contained in:
Thanaphon Frappet 2024-11-12 16:12:18 +07:00
parent 4ff7f50811
commit 0b648d8e45

View file

@ -201,23 +201,29 @@ export const useCustomerForm = defineStore('form-customer', () => {
payDateEN: v.payDateEN,
statusSave: true,
file: await customerStore.listAttachment(v.id).then(async (r) => {
if (r) {
return await Promise.all(
r.map(async (item) => {
const fragment = item.split('-');
const group = fragment.length === 1 ? 'other' : fragment.at(0);
file: await customerStore
.listAttachment({ parentId: v.id })
.then(async (r) => {
if (r) {
return await Promise.all(
r.map(async (item) => {
const fragment = item.split('-');
const group =
fragment.length === 1 ? 'other' : fragment.at(0);
return {
url: await customerStore.getAttachment(v.id, item),
name: item,
group: group,
};
}),
);
}
return [];
}),
return {
url: await customerStore.getAttachment({
parentId: v.id,
name: item,
}),
name: item,
group: group,
};
}),
);
}
return [];
}),
})),
);