Skip to content

Commit

Permalink
Added devtools debugging, fixed history to reorder when selecting a city
Browse files Browse the repository at this point in the history
  • Loading branch information
iKingCold committed Mar 4, 2024
1 parent 8009000 commit 63c9cd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
14 changes: 5 additions & 9 deletions weather-forecast/src/components/WeatherInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export default {
city: this.resultCity,
temperature: this.resultTemp,
weather: this.resultWeather,
latitude: this.cityLatitude,
longitude: this.cityLongitude
})
this.submitted = true
Expand All @@ -79,18 +77,16 @@ export default {
if (!cityExists) {
this.searchHistory.unshift(search); // Lägger till element i början av array
this.searchHistory = this.searchHistory.slice(0, 3); // Begränsar antalet element i array till 3, som visas på skärmen.
localStorage.setItem('searchHistory', JSON.stringify(this.searchHistory)); //Lägger till arrayen i LocalStorage.
}
else {
return;
let index = this.searchHistory.findIndex(city => city.city === search.city);
this.searchHistory.unshift(this.searchHistory.splice(index, 1)[0])
}
localStorage.setItem('searchHistory', JSON.stringify(this.searchHistory)); //Lägger till arrayen i LocalStorage.
},
ShowCityBoxClick(search) {
this.resultCity = search.city;
this.resultTemp = search.temperature;
this.resultWeather = search.weather;
this.cityLatitude = search.latitude;
this.cityLongitude = search.longitude;
this.city = search.city;
this.FetchWeather();
this.submitted = true;
},
Expand Down
1 change: 1 addition & 0 deletions weather-forecast/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const webpack = require('webpack');

module.exports = defineConfig({
configureWebpack: {
devtool: 'source-map',
plugins: [
new webpack.DefinePlugin({
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false',
Expand Down

0 comments on commit 63c9cd4

Please sign in to comment.