ต่อ Api หน้ Address
This commit is contained in:
parent
79182a1e86
commit
8d2b93b6a3
4 changed files with 48 additions and 26 deletions
|
|
@ -241,7 +241,7 @@ import { useExamDataStore } from '@/modules/01_exam/store'
|
|||
const mixin = useCounterMixin()
|
||||
const store = useExamDataStore()
|
||||
const { date2Thai, calAge } = mixin
|
||||
|
||||
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
|
||||
const edit = ref<boolean>(false)
|
||||
const addressData = ref<Address>(defaultAddress)
|
||||
const myform = ref<any>()
|
||||
|
|
@ -272,11 +272,32 @@ const props = defineProps({
|
|||
|
||||
const emit = defineEmits(['update:statusEdit'])
|
||||
|
||||
onMounted(() => {
|
||||
fetchProvince()
|
||||
fetchDistrict(addressData.value.provinceId, '1')
|
||||
fetchDistrict(addressData.value.provinceIdC, '2')
|
||||
onMounted(async () => {
|
||||
await fetchData()
|
||||
await fetchProvince()
|
||||
await fetchDistrict(addressData.value.provinceId, '1')
|
||||
await fetchDistrict(addressData.value.provinceIdC, '2')
|
||||
})
|
||||
const fetchData = async () => {
|
||||
await http
|
||||
.get(config.API.candidateAddress(candidateId.value))
|
||||
.then((res) => {
|
||||
const data = res.data.result
|
||||
addressData.value.provinceId = data.registProvinceId
|
||||
addressData.value.provinceIdC = data.currentProvinceId
|
||||
addressData.value.districtId = data.registDistrictId
|
||||
addressData.value.districtIdC = data.currentDistrictId
|
||||
addressData.value.subdistrictId = data.registSubDistrictId
|
||||
addressData.value.subdistrictIdC = data.currentSubDistrictId
|
||||
addressData.value.code = data.registZipCode
|
||||
addressData.value.codeC = data.currentZipCode
|
||||
// informaData.value = data
|
||||
})
|
||||
.catch((e: any) => {})
|
||||
.finally(() => {
|
||||
// loader.value = false;
|
||||
})
|
||||
}
|
||||
|
||||
const saveData = async () => {
|
||||
if (store.consend == true) {
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ onMounted(async () => {
|
|||
})
|
||||
const fetchData = async () => {
|
||||
await http
|
||||
.get(config.API.countDashbordSubHistory(candidateId.value))
|
||||
.get(config.API.candidateInformation(candidateId.value))
|
||||
.then((res) => {
|
||||
const data = res.data.result
|
||||
informaData.value.prefix = data.prefixId
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue