From 6151380ab1d6f2e6c8a5bcd04d7d6c58ea13b193 Mon Sep 17 00:00:00 2001 From: Gerome Matilla Date: Sat, 13 Jun 2020 18:32:41 +0800 Subject: [PATCH] weathersettings cleanup --- js/weather-settings.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/weather-settings.js b/js/weather-settings.js index 1a8be52..7e046b5 100644 --- a/js/weather-settings.js +++ b/js/weather-settings.js @@ -57,8 +57,8 @@ class WeatherSettings { // Reset textboxes _deleteWeatherSettingsValue = () => { - this._apiKeySet.value = ''; - this._cityIDSet.value = ''; + this._apiKeySet.value = null; + this._cityIDSet.value = null; this._weatherSelectUnits.value = 'metric'; this._weatherSelectLocator.value = 'city'; } @@ -238,9 +238,12 @@ class WeatherSettings { this._deleteWeatherSettingsValue(); this._updateWeatherSettingsPlaceholder(); - // Show city id textbox - this._weatherSettingsCityIDGroup.classList.remove('hideWeatherSettings'); - + // Show/hide city id textbox based on the default mode + if (this._locatorMode === 'geolocation') { + this._weatherSettingsCityIDGroup.classList.add('hideWeatherSettings'); + } else if (this._locatorMode === 'city') { + this._weatherSettingsCityIDGroup.classList.remove('hideWeatherSettings'); + } alert('Credentials deleted!'); }