Merge pull request #388 from orangemug/fix/glyph-key-replace

Fix glyph key replace
This commit is contained in:
Orange Mug
2018-09-22 15:50:12 +01:00
committed by GitHub
+6 -3
View File
@@ -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)
}
} }
} }