properly read units from local storage on startup

This commit is contained in:
Matt Walsh 2022-08-04 13:59:21 -05:00
parent 037499dfb1
commit 88a17587b3
2 changed files with 3 additions and 1 deletions

View file

@ -127,8 +127,10 @@ const index = (() => {
const TwcUnits = localStorage.getItem('TwcUnits'); const TwcUnits = localStorage.getItem('TwcUnits');
if (!TwcUnits || TwcUnits === 'ENGLISH') { if (!TwcUnits || TwcUnits === 'ENGLISH') {
document.getElementById('radEnglish').checked = true; document.getElementById('radEnglish').checked = true;
navigation.message({ type: 'units', message: 'english' });
} else if (TwcUnits === 'METRIC') { } else if (TwcUnits === 'METRIC') {
document.getElementById('radMetric').checked = true; document.getElementById('radMetric').checked = true;
navigation.message({ type: 'units', message: 'metric' });
} }
document.getElementById('radEnglish').addEventListener('change', changeUnits); document.getElementById('radEnglish').addEventListener('change', changeUnits);

View file

@ -93,7 +93,7 @@
<div id="hourly-html" class="weather-display"> <div id="hourly-html" class="weather-display">
<%- include('partials/hourly.ejs') %> <%- include('partials/hourly.ejs') %>
</div> </div>
<div id="current-weather-html" class="weather-display show"> <div id="current-weather-html" class="weather-display">
<%- include('partials/current-weather.ejs') %> <%- include('partials/current-weather.ejs') %>
</div> </div>
<div id="local-forecast-html" class="weather-display"> <div id="local-forecast-html" class="weather-display">