ต่อ API

This commit is contained in:
setthawutttty 2024-11-01 17:25:19 +07:00
parent daa78078a2
commit c776d4e7f1
10 changed files with 105 additions and 103 deletions

View file

@ -7,7 +7,7 @@ import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import { useDataLinkCenter } from "@/modules/04_registryPerson/stores/LinkCenter";
import { useProfileDataStore } from "@/modules/04_registryPerson/stores/profile";
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
import type { FormPerson } from "@/modules/04_registryPerson/interface/index/family";
import Header from "@/components/DialogHeader.vue"; // popup
@ -15,6 +15,7 @@ import Header from "@/components/DialogHeader.vue"; //ส่วนหัว popu
const $q = useQuasar();
const mixin = useCounterMixin();
const storeLinkCenter = useDataLinkCenter();
const storeRequestEdit = useRequestEditStore();
const storeProfile = useProfileDataStore();
const {
@ -56,30 +57,30 @@ async function closeDialog() {
fatherData.job = "";
}
async function onSubmit() {
function onSubmit() {
dialogConfirm($q, async () => {
const body = {
profileId: profileId.value,
fatherCitizenId: fatherData.citizenId,
fatherPrefix: fatherData.prefix,
fatherFirstName: fatherData.firstName,
fatherLastName: fatherData.lastName,
fatherCareer: fatherData.job,
fatherLive: fatherData.isLive === 1 ? true : false,
};
showLoader();
http
.post(config.API.profileFamily("", "father"), body)
.patch(
config.API.requestInformationbyType("father", storeRequestEdit.profileId),
body
)
.then(async (res) => {
await upDateStatus();
success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
await props.fetchData?.();
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
});
}
@ -102,6 +103,7 @@ async function upDateStatus() {
hideLoader();
});
}
watch(
() => modal.value,
() => {