diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-11-01 20:57:02 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-11-01 20:57:02 -0800 |
commit | cea47047f296b25794ebb06f679b590c0b42448e (patch) | |
tree | da6d49cbb7da9db5f68ef37c931d0d4085286c93 /modern/src/map | |
parent | fb330f777ceb0e531699ea0842c0199622114288 (diff) | |
download | trackermap-web-cea47047f296b25794ebb06f679b590c0b42448e.tar.gz trackermap-web-cea47047f296b25794ebb06f679b590c0b42448e.tar.bz2 trackermap-web-cea47047f296b25794ebb06f679b590c0b42448e.zip |
Enable mapbox maps
Diffstat (limited to 'modern/src/map')
-rw-r--r-- | modern/src/map/Map.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modern/src/map/Map.js b/modern/src/map/Map.js index a718798d..1e75d30a 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); |