diff options
Diffstat (limited to 'modern/src')
-rw-r--r-- | modern/src/UpdateController.tsx | 4 | ||||
-rw-r--r-- | modern/src/common/util/preferences.js | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/modern/src/UpdateController.tsx b/modern/src/UpdateController.tsx index 0f1b800b..991ea346 100644 --- a/modern/src/UpdateController.tsx +++ b/modern/src/UpdateController.tsx @@ -2,14 +2,14 @@ import { Snackbar, IconButton } from '@mui/material'; import RefreshIcon from '@mui/icons-material/Refresh'; import React from 'react' import { useTranslation } from './common/components/LocalizationProvider'; -import { useAttributePreference } from './common/util/preferences'; +import { useServerAttributePreference } from './common/util/preferences'; import { useRegisterSW } from 'virtual:pwa-register/react' // Based on https://vite-pwa-org.netlify.app/frameworks/react.html function UpdateController() { const t = useTranslation(); - const serviceWorkerUpdateInterval = useAttributePreference('serviceWorkerUpdateInterval', 3600000); + const serviceWorkerUpdateInterval = useServerAttributePreference('serviceWorkerUpdateInterval', 3600000); const { needRefresh: [needRefresh], diff --git a/modern/src/common/util/preferences.js b/modern/src/common/util/preferences.js index 229b6f17..0604d848 100644 --- a/modern/src/common/util/preferences.js +++ b/modern/src/common/util/preferences.js @@ -39,3 +39,10 @@ export const useAttributePreference = (key, defaultValue) => useSelector((state) } return defaultValue; }); + +export const useServerAttributePreference = (key, defaultValue) => useSelector((state) => { + if (containsProperty(state.session.server.attributes, key)) { + return state.session.server.attributes[key]; + } + return defaultValue; +});
\ No newline at end of file |