Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-08-08 18:10:01 +07:00
commit c3a32359de

View file

@ -268,10 +268,9 @@ function onSubmit() {
() => {
showLoader();
dialogStatus.value === "create" ? addData() : editData(editId.value);
// if (!!fileUpload.value) {
closeDialog();
if (!!fileUpload.value) {
uploadProfile(fileUpload.value);
}
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
@ -279,14 +278,14 @@ function onSubmit() {
}
}
async function uploadProfile(file: File | undefined) {
async function uploadProfile(id: string) {
await http
.post(
config.API.subFile(
"ทะเบียนประวัติ",
"ประวัติการเปลี่ยนชื่อ-นามสกุล",
profileId.value,
subId.value
id
),
{
replace: true,
@ -299,7 +298,7 @@ async function uploadProfile(file: File | undefined) {
)
.then(async (res) => {
uploadUrl.value = res.data["เอกสารหลักฐาน"].uploadUrl;
uploadFileURL(uploadUrl.value, file);
uploadFileURL(uploadUrl.value, fileUpload.value);
})
.catch((err) => {
messageError($q, err);
@ -379,11 +378,13 @@ async function addData() {
status: changeNameData.status,
documentId: changeNameData.documentId,
})
.then((res) => {
subId.value = res.data.result;
.then(async (res) => {
subId.value = await res.data.result;
uploadProfile(res.data.result);
fetchData(profileId.value);
props?.fetchDataPersonal?.();
fetchDataPersonal();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
@ -404,8 +405,11 @@ function editData(idData: string) {
}
)
.then(() => {
uploadProfile(subId.value);
fetchData(profileId.value);
props.fetchDataPersonal?.();
fetchDataPersonal();
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {