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, payDateEN: v.payDateEN,
statusSave: true, statusSave: true,
file: await customerStore.listAttachment(v.id).then(async (r) => { file: await customerStore
if (r) { .listAttachment({ parentId: v.id })
return await Promise.all( .then(async (r) => {
r.map(async (item) => { if (r) {
const fragment = item.split('-'); return await Promise.all(
const group = fragment.length === 1 ? 'other' : fragment.at(0); r.map(async (item) => {
const fragment = item.split('-');
const group =
fragment.length === 1 ? 'other' : fragment.at(0);
return { return {
url: await customerStore.getAttachment(v.id, item), url: await customerStore.getAttachment({
name: item, parentId: v.id,
group: group, name: item,
}; }),
}), name: item,
); group: group,
} };
return []; }),
}), );
}
return [];
}),
})), })),
); );