refactor: edit typo addressStore

This commit is contained in:
Thanaphon Frappet 2024-11-14 14:51:40 +07:00
parent fcb4c4a5f8
commit d764650b63

View file

@ -34,7 +34,7 @@ defineProps<{
useWorkPlace?: boolean; useWorkPlace?: boolean;
}>(); }>();
const adrressStore = useAddressStore(); const addressStore = useAddressStore();
const workplace = defineModel<string>('workplace', { default: '' }); const workplace = defineModel<string>('workplace', { default: '' });
const workplaceEN = defineModel<string>('workplaceEn', { default: '' }); const workplaceEN = defineModel<string>('workplaceEn', { default: '' });
const address = defineModel('address', { default: '' }); const address = defineModel('address', { default: '' });
@ -81,6 +81,8 @@ const addrOptions = reactive<{
const { t } = useI18n(); const { t } = useI18n();
const area = computed(() => {});
const fullAddress = computed(() => { const fullAddress = computed(() => {
const province = provinceOptions.value.find((v) => v.id === provinceId.value); const province = provinceOptions.value.find((v) => v.id === provinceId.value);
const district = districtOptions.value.find((v) => v.id === districtId.value); const district = districtOptions.value.find((v) => v.id === districtId.value);
@ -135,7 +137,7 @@ const fullAddressEN = computed(() => {
}); });
async function fetchProvince() { async function fetchProvince() {
const result = await adrressStore.fetchProvince(); const result = await addressStore.fetchProvince();
if (result) addrOptions.provinceOps = result; if (result) addrOptions.provinceOps = result;
@ -155,7 +157,7 @@ async function fetchProvince() {
async function fetchDistrict() { async function fetchDistrict() {
if (!provinceId.value) return; if (!provinceId.value) return;
const result = await adrressStore.fetchDistrictByProvinceId(provinceId.value); const result = await addressStore.fetchDistrictByProvinceId(provinceId.value);
if (result) addrOptions.districtOps = result; if (result) addrOptions.districtOps = result;
districtFilter = selectFilterOptionRefMod( districtFilter = selectFilterOptionRefMod(
@ -173,7 +175,7 @@ async function fetchDistrict() {
async function fetchSubDistrict() { async function fetchSubDistrict() {
if (!districtId.value) return; if (!districtId.value) return;
const result = await adrressStore.fetchSubDistrictByProvinceId( const result = await addressStore.fetchSubDistrictByProvinceId(
districtId.value, districtId.value,
); );
if (result) addrOptions.subDistrictOps = result; if (result) addrOptions.subDistrictOps = result;