From 9aa2ae64102408a3dc8f19916060b2cc6a77333f Mon Sep 17 00:00:00 2001 From: z0ccc Date: Mon, 24 Oct 2022 19:45:32 -0400 Subject: [PATCH] Fixed systemData storage issue for default --- src/Popup/Pages/SystemPage/index.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Popup/Pages/SystemPage/index.tsx b/src/Popup/Pages/SystemPage/index.tsx index 40d00cb..7f5facc 100644 --- a/src/Popup/Pages/SystemPage/index.tsx +++ b/src/Popup/Pages/SystemPage/index.tsx @@ -28,14 +28,6 @@ const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => { chrome.storage.local.get( ['systemType', 'configuration', 'timezone', 'locale', 'lat', 'lon'], (storage) => { - if (ipData) { - chrome.storage.local.set({ - timezone: ipData.timezone, - locale: countryLocales[ipData.countryCode].locale, - lat: ipData.lat, - lon: ipData.lon, - }) - } if (!storage.systemType || storage.systemType === 'default') { setTimezone(Intl.DateTimeFormat().resolvedOptions().timeZone) setLocale(Intl.DateTimeFormat().resolvedOptions().locale) @@ -49,6 +41,12 @@ const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => { setLocale(countryLocales[ipData.countryCode].locale) setLatitude(`${ipData.lat}`) setLongitude(`${ipData.lon}`) + chrome.storage.local.set({ + timezone: ipData.timezone, + locale: countryLocales[ipData.countryCode].locale, + lat: ipData.lat, + lon: ipData.lon, + }) } else if (storage.systemType === 'custom') { storage.configuration && setConfiguration(storage.configuration) storage.timezone && setTimezone(storage.timezone)