Fixed systemData storage issue for default
This commit is contained in:
parent
8e9a5da964
commit
9aa2ae6410
1 changed files with 6 additions and 8 deletions
|
|
@ -28,14 +28,6 @@ const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => {
|
||||||
chrome.storage.local.get(
|
chrome.storage.local.get(
|
||||||
['systemType', 'configuration', 'timezone', 'locale', 'lat', 'lon'],
|
['systemType', 'configuration', 'timezone', 'locale', 'lat', 'lon'],
|
||||||
(storage) => {
|
(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') {
|
if (!storage.systemType || storage.systemType === 'default') {
|
||||||
setTimezone(Intl.DateTimeFormat().resolvedOptions().timeZone)
|
setTimezone(Intl.DateTimeFormat().resolvedOptions().timeZone)
|
||||||
setLocale(Intl.DateTimeFormat().resolvedOptions().locale)
|
setLocale(Intl.DateTimeFormat().resolvedOptions().locale)
|
||||||
|
|
@ -49,6 +41,12 @@ const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => {
|
||||||
setLocale(countryLocales[ipData.countryCode].locale)
|
setLocale(countryLocales[ipData.countryCode].locale)
|
||||||
setLatitude(`${ipData.lat}`)
|
setLatitude(`${ipData.lat}`)
|
||||||
setLongitude(`${ipData.lon}`)
|
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') {
|
} else if (storage.systemType === 'custom') {
|
||||||
storage.configuration && setConfiguration(storage.configuration)
|
storage.configuration && setConfiguration(storage.configuration)
|
||||||
storage.timezone && setTimezone(storage.timezone)
|
storage.timezone && setTimezone(storage.timezone)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue