Skip to content

Commit

Permalink
fix: api key console error
Browse files Browse the repository at this point in the history
  • Loading branch information
Kizito007 committed Oct 23, 2024
1 parent 3c98a59 commit 6147abd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/MaplibreGLLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ export var MaplibreGLJSLayer = Layer.extend({

this._glMap = new maplibregl.Map(options);

// Listen for style data error (401 Unauthorized)
this._glMap.on('error', function (error) {
if (error.error && error.error.status === 401) {
console.warn('Invalid API key. Please check your ArcGIS API key.');
}
});

// Fire event for Maplibre "styledata" event.
this._glMap.once(
'styledata',
Expand Down Expand Up @@ -322,6 +329,6 @@ export var MaplibreGLJSLayer = Layer.extend({
}
});

export function maplibreGLJSLayer (options) {
export function maplibreGLJSLayer(options) {

Check failure on line 332 in src/MaplibreGLLayer.js

View workflow job for this annotation

GitHub Actions / lint

Missing space before function parentheses

Check failure on line 332 in src/MaplibreGLLayer.js

View workflow job for this annotation

GitHub Actions / test (Chrome1280x1024)

Missing space before function parentheses

Check failure on line 332 in src/MaplibreGLLayer.js

View workflow job for this annotation

GitHub Actions / test (FirefoxTouch)

Missing space before function parentheses

Check failure on line 332 in src/MaplibreGLLayer.js

View workflow job for this annotation

GitHub Actions / test (FirefoxNoTouch)

Missing space before function parentheses

Check failure on line 332 in src/MaplibreGLLayer.js

View workflow job for this annotation

GitHub Actions / test (Edge, windows-latest)

Missing space before function parentheses
return new MaplibreGLJSLayer(options);
}

0 comments on commit 6147abd

Please sign in to comment.