How to use the @mapbox/mapbox-sdk function in @mapbox/mapbox-sdk

To help you get started, we’ve selected a few @mapbox/mapbox-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github department-of-veterans-affairs / vets-website / src / applications / facility-locator / components / MapboxClient.js View on Github external
import MapboxClient2 from 'mapbox'; // TODO remove dependency after QA

import { mapboxToken } from '../utils/mapboxToken';
import environments from '../../../platform/utilities/environment';

/**
 New: @mapbox/mapbox-sdk is initialized with the accessToken key as an object

 The conditional is for using the SDK version according to the environment ( New SDK in staging temporarily for QA)
 TODO: remove this logic after new sdk tested in staging

 MapboxClient1 : New SDK
 MapboxClient2 : Current SDK
*/
export const mapboxClient = environments.isStaging()
  ? new MapboxClient1({ accessToken: mapboxToken })
  : new MapboxClient2(mapboxToken);

export default mapboxClient;