This commit is contained in:
parent
35c742d9f4
commit
8a6a21d80c
@ -25,6 +25,7 @@ export default defineNuxtComponent({
|
||||
locID: null,
|
||||
locations: [],
|
||||
databaseLocations: [],
|
||||
|
||||
weatherData: [],
|
||||
weatherIcons: {
|
||||
1: [0],
|
||||
@ -90,9 +91,7 @@ export default defineNuxtComponent({
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls the API to fetch weather data for the specified location.
|
||||
* a bulk parameter can be passed to fetch weather data for a list oflocations
|
||||
* or a single location.
|
||||
* A description of the entire function.
|
||||
*
|
||||
* @param {type} bulk - description of parameter
|
||||
* @param {type} location - description of parameter
|
||||
|
@ -48,13 +48,6 @@ export default defineNuxtComponent({
|
||||
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) {
|
||||
this.apiURL = `${this.apiBaseURL}/locations`;
|
||||
if (input) {
|
||||
@ -74,7 +67,6 @@ export default defineNuxtComponent({
|
||||
await this.addNewLocID(idx + 1);
|
||||
await this.fetchWeatherData(false, idx + 1);
|
||||
}
|
||||
|
||||
await $fetch(this.apiURL, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
@ -108,6 +100,7 @@ export default defineNuxtComponent({
|
||||
await this.addNewLocID(idx + 1);
|
||||
await this.fetchWeatherData(false, idx + 1);
|
||||
this.displayNotification('add', input);
|
||||
|
||||
this.closeModal('add');
|
||||
}
|
||||
}
|
||||
@ -116,9 +109,7 @@ export default defineNuxtComponent({
|
||||
this.apiURL = '';
|
||||
if (this.searchInput.length > 1) {
|
||||
this.locationData = [];
|
||||
|
||||
this.apiURL = this.apiBaseURL + '/location/search?query=' + this.searchInput;
|
||||
console.log(this.apiURL);
|
||||
await fetch(this.apiURL)
|
||||
.then((res) => res.json())
|
||||
.then((json) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user