Skip to content

Commit 45776c4

Browse files
committed
Location filter updated
1 parent 5a18268 commit 45776c4

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/components/initiatives/list/LocationFilter.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default {
8787
methods: {
8888
fetchRegions() {
8989
this.$http
90-
.get("/v1/regions?size=100")
90+
.get("/v1/regions?having=cities&size=100")
9191
.then(res => {
9292
this.dataRegions = res.data.data;
9393
})
@@ -105,7 +105,7 @@ export default {
105105
this.selectedCity = null;
106106
this.$emit("saveRegion", selectedRegion);
107107
this.$http
108-
.get(`/v1/countries?size=100&region_id=${selectedRegion.id}`)
108+
.get(`/v1/countries?having=cities&size=100&region_id=${selectedRegion.id}`)
109109
.then(res => {
110110
this.dataCountries = res.data.data;
111111
})
@@ -128,7 +128,7 @@ export default {
128128
this.fetchingCities = true;
129129
this.$http
130130
.get(
131-
`/v1/registered-cities?size=100&country_id=${this.selectedCountry.id}&s=${name}`
131+
`/v1/registered-cities?&ize=100&country_id=${this.selectedCountry.id}&s=${name}`
132132
)
133133
.then(res => {
134134
this.dataCities = res.data.data;

src/views/initiatives/List.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,12 @@ export default {
156156
}
157157
if(this.selectedAreas.length) queryString.terms = this.selectedAreas.join(',')
158158
if(this.inputSearchName) queryString.s = this.inputSearchName
159-
if(this.selectedRegion) queryString.region_id = this.selectedRegion.id
160-
if(this.selectedCountry) queryString.country_id = this.selectedCountry.id
161-
if(this.selectedCity) queryString.city_id = this.selectedCity.id
159+
if (this.selectedCity) queryString.city_id = this.selectedCity.id
160+
else if(this.selectedCountry) {
161+
queryString.country_id = this.selectedCountry.id
162+
} else if(this.selectedRegion) {
163+
queryString.region_id = this.selectedRegion.id
164+
}
162165
if(this.notLocated) queryString.city_id = -1
163166
this.$http
164167
.get(`/v1/initiatives`, {

0 commit comments

Comments
 (0)