Merge pull request #137 from seanmorley15/development
User agent config
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
let modal: HTMLDialogElement;
|
let modal: HTMLDialogElement;
|
||||||
|
import { appVersion } from '$lib/config';
|
||||||
|
|
||||||
import { DefaultMarker, MapEvents, MapLibre, Popup } from 'svelte-maplibre';
|
import { DefaultMarker, MapEvents, MapLibre, Popup } from 'svelte-maplibre';
|
||||||
|
|
||||||
@@ -55,7 +56,11 @@
|
|||||||
alert('Please enter a location');
|
alert('Please enter a location');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`);
|
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`, {
|
||||||
|
headers: {
|
||||||
|
'User-Agent': `AdventureLog / ${appVersion} `
|
||||||
|
}
|
||||||
|
});
|
||||||
console.log(res);
|
console.log(res);
|
||||||
let data = (await res.json()) as OpenStreetMapPlace[];
|
let data = (await res.json()) as OpenStreetMapPlace[];
|
||||||
places = data;
|
places = data;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
import EditAdventure from '$lib/components/EditAdventure.svelte';
|
import EditAdventure from '$lib/components/EditAdventure.svelte';
|
||||||
|
import { appVersion } from '$lib/config';
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
@@ -25,13 +26,21 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`);
|
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`, {
|
||||||
|
headers: {
|
||||||
|
'User-Agent': `AdventureLog / ${appVersion} `
|
||||||
|
}
|
||||||
|
});
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
osmResults = data;
|
osmResults = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`);
|
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`, {
|
||||||
|
headers: {
|
||||||
|
'User-Agent': `AdventureLog / ${appVersion} `
|
||||||
|
}
|
||||||
|
});
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
osmResults = data;
|
osmResults = data;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user