PK index fixes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Argiris Deligiannidis 2024-04-15 02:26:34 +03:00
parent 35c742d9f4
commit 8a6a21d80c
2 changed files with 3 additions and 13 deletions

View File

@ -25,6 +25,7 @@ export default defineNuxtComponent({
locID: null, locID: null,
locations: [], locations: [],
databaseLocations: [], databaseLocations: [],
weatherData: [], weatherData: [],
weatherIcons: { weatherIcons: {
1: [0], 1: [0],
@ -90,9 +91,7 @@ export default defineNuxtComponent({
}, },
/** /**
* Calls the API to fetch weather data for the specified location. * A description of the entire function.
* a bulk parameter can be passed to fetch weather data for a list oflocations
* or a single location.
* *
* @param {type} bulk - description of parameter * @param {type} bulk - description of parameter
* @param {type} location - description of parameter * @param {type} location - description of parameter

View File

@ -48,13 +48,6 @@ export default defineNuxtComponent({
getWeatherIcon(wmoCode) { getWeatherIcon(wmoCode) {
return utils.getWeatherIcon(wmoCode); return utils.getWeatherIcon(wmoCode);
}, },
/**
* Adds a new location based on the input provided.
* if the location already exists in the database, it will not be added.
*
*
* @param {Object} input - The input object containing location details.
*/
async addLocation(input) { async addLocation(input) {
this.apiURL = `${this.apiBaseURL}/locations`; this.apiURL = `${this.apiBaseURL}/locations`;
if (input) { if (input) {
@ -74,7 +67,6 @@ export default defineNuxtComponent({
await this.addNewLocID(idx + 1); await this.addNewLocID(idx + 1);
await this.fetchWeatherData(false, idx + 1); await this.fetchWeatherData(false, idx + 1);
} }
await $fetch(this.apiURL, { await $fetch(this.apiURL, {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
@ -108,6 +100,7 @@ export default defineNuxtComponent({
await this.addNewLocID(idx + 1); await this.addNewLocID(idx + 1);
await this.fetchWeatherData(false, idx + 1); await this.fetchWeatherData(false, idx + 1);
this.displayNotification('add', input); this.displayNotification('add', input);
this.closeModal('add'); this.closeModal('add');
} }
} }
@ -116,9 +109,7 @@ export default defineNuxtComponent({
this.apiURL = ''; this.apiURL = '';
if (this.searchInput.length > 1) { if (this.searchInput.length > 1) {
this.locationData = []; this.locationData = [];
this.apiURL = this.apiBaseURL + '/location/search?query=' + this.searchInput; this.apiURL = this.apiBaseURL + '/location/search?query=' + this.searchInput;
console.log(this.apiURL);
await fetch(this.apiURL) await fetch(this.apiURL)
.then((res) => res.json()) .then((res) => res.json())
.then((json) => { .then((json) => {