Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sadparadiseinhell committed Mar 7, 2021
1 parent 8b28efb commit 011d46a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions js/weather.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,19 @@ function getWeatherInfo(key, city) {
}

function drawWeather() {
if (JSON.parse(localStorage.getItem('weather')).tempUnit === 'C') {
if (weatherLS) {
if (JSON.parse(weatherLS).tempUnit === 'C') {
temp = `${celsius}\u00B0C`;
radioCelsius.checked = true;
} else {
temp = `${fahrenheit}\u00B0F`;
radioFahrenheit.checked = true;
}
}

if (!weatherLS) {
temp = `${celsius}\u00B0C`;
radioCelsius.checked = true;
} else {
temp = `${fahrenheit}\u00B0F`;
radioFahrenheit.checked = true;
}

info.innerHTML = `${description}, <span class="header__weather-temp">${temp}</span>`;
Expand Down

0 comments on commit 011d46a

Please sign in to comment.