From 2c1cd9a84484afcbd002a1050fb5bca0034d515a Mon Sep 17 00:00:00 2001 From: Argiris Deligiannidis Date: Mon, 15 Apr 2024 09:25:43 +0300 Subject: [PATCH] PK index fixes --- components/WeatherModals/AddLocation.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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,