fixing change name in registry
This commit is contained in:
parent
37f0ecbc1e
commit
df333c6db1
1 changed files with 12 additions and 8 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue