Merge pull request 'dynamically import the maptiler api key' (#8) from dev into staging
Reviewed-on: #8
This commit is contained in:
@@ -55,9 +55,9 @@
|
|||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const { Map, Marker, config } = await import('@maptiler/sdk');
|
const { Map, Marker, config } = await import('@maptiler/sdk');
|
||||||
const { PUBLIC_MAPTILER_API_KEY } = await import('$env/static/public');
|
const { env } = await import('$env/dynamic/public');
|
||||||
|
|
||||||
config.apiKey = PUBLIC_MAPTILER_API_KEY;
|
config.apiKey = env.PUBLIC_MAPTILER_API_KEY;
|
||||||
MapMarker = Marker;
|
MapMarker = Marker;
|
||||||
|
|
||||||
const initMap = (center: [number, number], zoom: number) => {
|
const initMap = (center: [number, number], zoom: number) => {
|
||||||
|
|||||||
@@ -68,8 +68,8 @@
|
|||||||
async function initMap() {
|
async function initMap() {
|
||||||
if (!mapContainer || lat === null || lng === null) return;
|
if (!mapContainer || lat === null || lng === null) return;
|
||||||
const { Map, Marker, config } = await import('@maptiler/sdk');
|
const { Map, Marker, config } = await import('@maptiler/sdk');
|
||||||
const { PUBLIC_MAPTILER_API_KEY } = await import('$env/static/public');
|
const { env } = await import('$env/dynamic/public');
|
||||||
config.apiKey = PUBLIC_MAPTILER_API_KEY;
|
config.apiKey = env.PUBLIC_MAPTILER_API_KEY;
|
||||||
|
|
||||||
map = new Map({
|
map = new Map({
|
||||||
container: mapContainer,
|
container: mapContainer,
|
||||||
|
|||||||
Reference in New Issue
Block a user