Skip to content

Commit

Permalink
fix: apiKey not set when calling geocoding.byId(...) (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
toniopelo authored Oct 24, 2023
1 parent 5c887ee commit 8b4b91a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/services/geocoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export type GeocodingOptions = CommonForwardAndReverseGeocodingOptions & {

export type ReverseGeocodingOptions = CommonForwardAndReverseGeocodingOptions;

export type ByIdGeocodingOptions = LanguageGeocodingOptions;
export type ByIdGeocodingOptions = LanguageGeocodingOptions & { apiKey?: string };

export type Coordinates = Position;

Expand Down Expand Up @@ -384,6 +384,7 @@ async function byId(
options: ByIdGeocodingOptions = {}
): Promise<GeocodingSearchResult> {
const endpoint = new URL(`geocoding/${id}.json`, defaults.maptilerApiURL);
endpoint.searchParams.set("key", options.apiKey ?? config.apiKey);

addLanguageGeocodingOptions(endpoint.searchParams, options);

Expand Down

0 comments on commit 8b4b91a

Please sign in to comment.