mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-29 07:50:28 +01:00
Only replace glyphs key if a replacement exists.
This commit is contained in:
parent
805133d10c
commit
7d0a985f1d
1 changed files with 6 additions and 3 deletions
|
@ -102,9 +102,12 @@ function replaceAccessTokens(mapStyle, opts={}) {
|
||||||
})
|
})
|
||||||
|
|
||||||
if (mapStyle.glyphs && mapStyle.glyphs.match(/\.tilehosting\.com/)) {
|
if (mapStyle.glyphs && mapStyle.glyphs.match(/\.tilehosting\.com/)) {
|
||||||
changedStyle = {
|
const newAccessToken = getAccessToken("openmaptiles", mapStyle, opts);
|
||||||
...changedStyle,
|
if (newAccessToken) {
|
||||||
glyphs: mapStyle.glyphs.replace('{key}', getAccessToken("openmaptiles", mapStyle, opts))
|
changedStyle = {
|
||||||
|
...changedStyle,
|
||||||
|
glyphs: mapStyle.glyphs.replace('{key}', newAccessToken)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue