From 10e3100426d769c1c7d717e4e9fa7c21b1a61baa Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Wed, 15 May 2019 14:52:17 +0100 Subject: [PATCH] correct mapbox token default --- example.config.js | 2 +- src/components/Map.jsx | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/example.config.js b/example.config.js index 09bbc8e..8e23e1c 100644 --- a/example.config.js +++ b/example.config.js @@ -9,7 +9,7 @@ module.exports = { SITES_EXT: '/api/example/export_sites/rows', SHAPES_EXT: '/api/example/export_shapes/columns', INCOMING_DATETIME_FORMAT: '%m/%d/%YT%H:%M', - MAPBOX_TOKEN: 'pk.EXAMPLE_MAPBOX_TOKEN', + // MAPBOX_TOKEN: 'pk.EXAMPLE_MAPBOX_TOKEN', features: { USE_COVER: false, USE_TAGS: false, diff --git a/src/components/Map.jsx b/src/components/Map.jsx index 0451da5..9dd2069 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -17,7 +17,6 @@ import DefsMarkers from './presentational/Map/DefsMarkers.jsx' // NB: important constants for map, TODO: make statics const supportedMapboxMap = ['streets', 'satellite'] -const defaultToken = 'your_token' class Map extends React.Component { constructor () { @@ -70,14 +69,17 @@ class Map extends React.Component { let firstLayer - if ((supportedMapboxMap.indexOf(this.props.ui.tiles) !== -1) && process.env.MAPBOX_TOKEN && process.env.MAPBOX_TOKEN !== defaultToken) { + // if mapbox token and one of the default maps are specified + if ((supportedMapboxMap.indexOf(this.props.ui.tiles) !== -1) && process.env.MAPBOX_TOKEN) { firstLayer = L.tileLayer( `http://a.tiles.mapbox.com/v4/mapbox.${this.props.ui.tiles}/{z}/{x}/{y}@2x.png?access_token=${process.env.MAPBOX_TOKEN}` ) - } else if (process.env.MAPBOX_TOKEN && process.env.MAPBOX_TOKEN !== defaultToken) { + // if mapbox token and custom map + } else if (process.env.MAPBOX_TOKEN) { firstLayer = L.tileLayer( `http://a.tiles.mapbox.com/styles/v1/${this.props.ui.tiles}/tiles/{z}/{x}/{y}?access_token=${process.env.MAPBOX_TOKEN}` ) + // no mapbox token } else { firstLayer = L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'