diff --git a/src/api/org/api.org.ts b/src/api/org/api.org.ts index a3d62c7..e3f8c51 100644 --- a/src/api/org/api.org.ts +++ b/src/api/org/api.org.ts @@ -119,7 +119,9 @@ export default { developmentUserByType: (type: string) => `${org}/profile${type}/development/user`, upDateNumber: `${profileOrg}/updatePhoneNumber/user`, + upDateNumberByType: (type: string) => `${org}/profile${type}/updatePhoneNumber/user`, updateEmail: `${profileOrg}/updateEmail/user`, + updateEmailByType: (type: string) => `${org}/profile${type}/updateEmail/user`, /** * workflow */ diff --git a/src/modules/10_registry/01_Information/01_Information.vue b/src/modules/10_registry/01_Information/01_Information.vue index addbc32..76b3bad 100644 --- a/src/modules/10_registry/01_Information/01_Information.vue +++ b/src/modules/10_registry/01_Information/01_Information.vue @@ -10,6 +10,7 @@ import config from "@/app.config"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; +const link = ref(""); const $q = useQuasar(); const store = useRegistryInFormationStore(); const dataStore = useDataStore(); @@ -243,7 +244,7 @@ function onHistory() { async function getData() { showLoader(); await http - .get(config.API.dataUserInformationByType(dataStore.officerLink)) + .get(config.API.dataUserInformationByType(link.value)) .then(async (res) => { const data = await res.data.result; formDataInformation.citizenId = data.citizenId; @@ -318,7 +319,7 @@ function onSubmitEdit(type: string) { /** บันทึกเบอร์โทร */ async function onSavePhone() { await http - .put(config.API.upDateNumber, { + .put(config.API.upDateNumberByType(link.value), { phone: formDataInformation.phone, }) .then(async (res) => { @@ -335,7 +336,7 @@ async function onSavePhone() { /** บันทึก email */ async function onSaveEmail() { await http - .put(config.API.updateEmail, { + .put(config.API.updateEmailByType(link.value), { email: formDataInformation.email + `@bangkok.go.th`, }) .then(async (res) => { @@ -350,6 +351,7 @@ async function onSaveEmail() { } onMounted(async () => { + link.value = await dataStore.getProFileType(); await getData(); }); diff --git a/src/modules/10_registry/01_Information/02_ChangeName.vue b/src/modules/10_registry/01_Information/02_ChangeName.vue index 86c06bb..0cd835c 100644 --- a/src/modules/10_registry/01_Information/02_ChangeName.vue +++ b/src/modules/10_registry/01_Information/02_ChangeName.vue @@ -10,6 +10,7 @@ import config from "@/app.config"; import type { ChangNameRows } from "@/modules/10_registry/interface/response/01_Information"; import DialogHistory from "@/modules/10_registry/Dialog/DialogHistory.vue"; +const link = ref(""); const $q = useQuasar(); const mixin = useCounterMixin(); const dataStore = useDataStore(); @@ -161,10 +162,10 @@ function onHistory(id: string) { } /** get data */ -function getData() { +async function getData() { showLoader(); http - .get(config.API.dataUserChangeNameByType(dataStore.officerLink)) + .get(config.API.dataUserChangeNameByType(link.value)) .then((res) => { const data = res.data.result; rows.value = data; @@ -183,7 +184,10 @@ function getData() { function getHistory() { showLoader(); http - .get(config.API.dataUserChangeNameHistoryByType(dataStore.officerLink) + `/${idByrow.value}`) + .get( + config.API.dataUserChangeNameHistoryByType(link.value) + + `/${idByrow.value}` + ) .then((res) => { const data = res.data.result; rowsHistory.value = data; @@ -196,8 +200,9 @@ function getHistory() { }); } -onMounted(() => { - getData(); +onMounted(async () => { + link.value = await dataStore.getProFileType(); + await getData(); });