refactor: br id

This commit is contained in:
puriphatt 2024-09-04 17:49:12 +07:00
parent db10c7619c
commit 55f26b3758
2 changed files with 41 additions and 10 deletions

View file

@ -59,12 +59,19 @@ const useUserStore = defineStore('api-user', () => {
const res = await branchStore.fetchById(id, {
includeSubBranch: true,
});
if (res && res?.branch) {
res.branch.map((item) => {
userOption.value.brOpts.push({
label: item.code,
value: item.id,
});
if (res && res.branch) {
res.branch.forEach((item) => {
const exists = userOption.value.brOpts.some(
(opt) => opt.value === item.id,
);
if (!exists) {
userOption.value.brOpts.push({
label: item.code,
value: item.id,
});
}
});
}
}