fix: type error and assign hq to user
This commit is contained in:
parent
0401cd2042
commit
02546b53aa
1 changed files with 11 additions and 2 deletions
|
|
@ -233,7 +233,13 @@ async function onSubmit() {
|
|||
persistent: true,
|
||||
message: 'คุณต้องการแก้ไขข้อมูล ใช่หรือไม่',
|
||||
action: async () => {
|
||||
const formDataEdit = { ...formData.value };
|
||||
const formDataEdit = {
|
||||
...formData.value,
|
||||
status:
|
||||
formData.value.status !== 'CREATED'
|
||||
? formData.value.status
|
||||
: undefined,
|
||||
};
|
||||
await userStore.editById(userId.value, formDataEdit);
|
||||
onClose();
|
||||
userStore.fetchList({ includeBranch: true });
|
||||
|
|
@ -250,7 +256,10 @@ async function onSubmit() {
|
|||
action: async () => {
|
||||
const result = await userStore.create(formData.value);
|
||||
if (result) {
|
||||
await branchStore.addUser(brId.value, result.id);
|
||||
await branchStore.addUser(
|
||||
!!brId.value ? brId.value : hqId.value,
|
||||
result.id,
|
||||
);
|
||||
}
|
||||
onClose();
|
||||
userStore.fetchList({ includeBranch: true });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue