aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common/util/preferences.js
diff options
context:
space:
mode:
authorMatjaž Črnko <m.crnko@txt.si>2023-11-06 15:48:27 +0100
committerMatjaž Črnko <m.crnko@txt.si>2023-11-06 15:48:27 +0100
commit41b513e0245e5c354508ef26e1a4ec89e67e7598 (patch)
tree322ba944b350e1a5e60e4b57d90a1ee19a54a361 /modern/src/common/util/preferences.js
parentf81bf48cb9cd3541bf8f111770fdd42c4d8e0955 (diff)
downloadtrackermap-web-41b513e0245e5c354508ef26e1a4ec89e67e7598.tar.gz
trackermap-web-41b513e0245e5c354508ef26e1a4ec89e67e7598.tar.bz2
trackermap-web-41b513e0245e5c354508ef26e1a4ec89e67e7598.zip
PWA: use only server attributes for serviceWorkerUpdateInterval
Diffstat (limited to 'modern/src/common/util/preferences.js')
-rw-r--r--modern/src/common/util/preferences.js7
1 files changed, 7 insertions, 0 deletions
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