fix: payload profileEmployeeId

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-03-25 09:18:51 +07:00
parent ecc10e16c9
commit 0a5f64c17c

View file

@ -57,16 +57,23 @@ function onSubmit() {
dialogConfirm($q, async () => {
try {
showLoader();
const playload = {
const payload = {
...form,
stampDate: convertDateToAPI(form.stampDate),
profileId: isStatusEdit.value ? undefined : profileId.value,
profileId:
!isStatusEdit.value && empType.value === ""
? profileId.value
: undefined,
profileEmployeeId:
!isStatusEdit.value && empType.value !== ""
? profileId.value
: undefined,
};
const method = isStatusEdit.value ? "patch" : "post";
const url = isStatusEdit.value
? config.API.profileAbsentLate(empType.value) + `/${rowId.value}`
: config.API.profileAbsentLate(empType.value);
await http[method](url, playload);
await http[method](url, payload);
success($q, "บันทึกข้อมูลสำเร็จ");
props.fetchData();
closeDialog();