diff --git a/src/components/CreateNewPostcodeForm.vue b/src/components/CreateNewPostcodeForm.vue index 66b2a30d3..141dcb142 100644 --- a/src/components/CreateNewPostcodeForm.vue +++ b/src/components/CreateNewPostcodeForm.vue @@ -23,9 +23,8 @@ const postcodeFormData = reactive({ }); const townsFetchDataRef = ref(false); -const countriesFetchDataRef = ref(false); +const countriesRef = ref(false); const provincesFetchDataRef = ref(false); -const countriesOptions = ref([]); const provincesOptions = ref([]); const townsOptions = ref([]); const town = ref({}); @@ -42,7 +41,7 @@ function onDataSaved(formData) { ({ id }) => id === formData.provinceFk ); newPostcode.province = provinceObject?.name; - const countryObject = countriesOptions.value.find( + const countryObject = countriesRef.value.opts.find( ({ id }) => id === formData.countryFk ); newPostcode.country = countryObject?.name; @@ -80,16 +79,6 @@ async function filterTowns(name) { await townsFetchDataRef.value?.fetch(); } } -async function filterCountries(name) { - if (name !== '') { - countryFilter.value.where = { - name: { - like: `%${name}%`, - }, - }; - await countriesFetchDataRef.value?.fetch(); - } -} async function fetchTowns(countryFk) { if (!countryFk) return; @@ -111,10 +100,6 @@ async function handleTowns(data) { townsOptions.value = data; } -async function handleCountries(data) { - countriesOptions.value = data; -} - async function setProvince(id, data) { const newProvince = provincesOptions.value.find((province) => province.id == id); if (!newProvince) return; @@ -148,15 +133,6 @@ async function onProvinceCreated(data) { auto-load url="Towns/location" /> -