ต่อ 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
@ -16,6 +16,8 @@ const $q = useQuasar();
const mixin = useCounterMixin();
const storeLinkCenter = useDataLinkCenter();
const storeProfile = useProfileDataStore();
const storeRequestEdit = useRequestEditStore();
const {
showLoader,
hideLoader,
@ -55,30 +57,30 @@ async function closeDialog() {
motherData.job = "";
}
async function onSubmit() {
function onSubmit() {
dialogConfirm($q, async () => {
const body = {
profileId: profileId.value,
motherCitizenId: motherData.citizenId,
motherPrefix: motherData.prefix,
motherFirstName: motherData.firstName,
motherLastName: motherData.lastName,
motherCareer: motherData.job,
motherLive: motherData.isLive === 1 ? true : false,
};
showLoader();
http
.post(config.API.profileFamily("", "mother"), body)
.patch(
config.API.requestInformationbyType("mother", storeRequestEdit.profileId),
body
)
.then(async (res) => {
await upDateStatus();
success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
await props.fetchData?.();
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
});
}