aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-11-01 20:57:02 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-11-01 20:57:02 -0800
commitcea47047f296b25794ebb06f679b590c0b42448e (patch)
treeda6d49cbb7da9db5f68ef37c931d0d4085286c93 /modern/src/map
parentfb330f777ceb0e531699ea0842c0199622114288 (diff)
downloadetbsa-traccar-web-cea47047f296b25794ebb06f679b590c0b42448e.tar.gz
etbsa-traccar-web-cea47047f296b25794ebb06f679b590c0b42448e.tar.bz2
etbsa-traccar-web-cea47047f296b25794ebb06f679b590c0b42448e.zip
Enable mapbox maps
Diffstat (limited to 'modern/src/map')
-rw-r--r--modern/src/map/Map.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/modern/src/map/Map.js b/modern/src/map/Map.js
index a718798..1e75d30 100644
--- a/modern/src/map/Map.js
+++ b/modern/src/map/Map.js
@@ -7,6 +7,7 @@ import { deviceCategories } from '../common/deviceCategories';
import { loadIcon, loadImage } from './mapUtil';
import { styleCarto, styleMapbox, styleOsm } from './mapStyles';
import t from '../common/localization';
+import { useAttributePreference } from '../common/preferences';
const element = document.createElement('div');
element.style.width = '100%';
@@ -75,7 +76,13 @@ const Map = ({ children }) => {
const containerEl = useRef(null);
const [mapReady, setMapReady] = useState(false);
-
+
+ const mapboxAccessToken = useAttributePreference('mapboxAccessToken');
+
+ useEffect(() => {
+ mapboxgl.accessToken = mapboxAccessToken;
+ }, [mapboxAccessToken]);
+
useEffect(() => {
const listener = ready => setMapReady(ready);
addReadyListener(listener);