diff --git a/components/WeatherModals/AddLocation.vue b/components/WeatherModals/AddLocation.vue index 5b1b392..f383e07 100644 --- a/components/WeatherModals/AddLocation.vue +++ b/components/WeatherModals/AddLocation.vue @@ -58,19 +58,19 @@ export default defineNuxtComponent({ this.databaseLocations[i]['name'].includes(input.name) && this.databaseLocations[i]['country'].includes(input.country) ) { - idx = i; + idx = Number(this.databaseLocations[i]['id']); break; } } if (idx > 0) { - if (!this.locations.includes(idx + 1)) { - await this.addNewLocID(idx + 1); - await this.fetchWeatherData(false, idx + 1); + if (!this.locations.includes(idx)) { + await this.addNewLocID(idx); + await this.fetchWeatherData(false, idx); } await $fetch(this.apiURL, { method: 'POST', body: JSON.stringify({ - id: idx + 1, + id: idx, name: 'existing', country: '', longitude: 0,