mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-06-01 10:04:00 +00:00
Move next js project to archive (#207)
This commit is contained in:
12
archive/next-js-web-app/src/config/mapbox/geocoder.ts
Normal file
12
archive/next-js-web-app/src/config/mapbox/geocoder.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import mbxGeocoding from '@mapbox/mapbox-sdk/services/geocoding';
|
||||
|
||||
import { MAPBOX_ACCESS_TOKEN } from '../env';
|
||||
|
||||
const geocoder = mbxGeocoding({ accessToken: MAPBOX_ACCESS_TOKEN });
|
||||
|
||||
const geocode = async (query: string) => {
|
||||
const geoData = await geocoder.forwardGeocode({ query, limit: 1 }).send();
|
||||
return geoData.body.features[0];
|
||||
};
|
||||
|
||||
export default geocode;
|
||||
Reference in New Issue
Block a user