chore: Update app version to v0.5.1 and fix toast component styling
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import type { Adventure } from '$lib/types';
|
||||
import type { Adventure, OpenStreetMapPlace } from '$lib/types';
|
||||
import { fail } from '@sveltejs/kit';
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { appVersion } from '$lib/config';
|
||||
|
||||
const PUBLIC_SERVER_URL = process.env['PUBLIC_SERVER_URL'];
|
||||
const serverEndpoint = PUBLIC_SERVER_URL || 'http://localhost:8000';
|
||||
|
||||
export const load = (async (event) => {
|
||||
// get url param query
|
||||
const query = event.url.searchParams.get('query');
|
||||
const property = event.url.searchParams.get('property') || 'all';
|
||||
|
||||
@@ -23,19 +24,33 @@ export const load = (async (event) => {
|
||||
}
|
||||
);
|
||||
|
||||
if (res.ok) {
|
||||
let data = await res.json();
|
||||
console.log('Search data:', data);
|
||||
|
||||
return {
|
||||
props: {
|
||||
adventures: data,
|
||||
query
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (!res.ok) {
|
||||
console.error('Failed to fetch search data');
|
||||
let error = await res.json();
|
||||
return { error: error.error };
|
||||
}
|
||||
|
||||
let adventures: Adventure[] = await res.json();
|
||||
|
||||
let osmRes = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`, {
|
||||
headers: {
|
||||
'User-Agent': `AdventureLog / ${appVersion} `
|
||||
}
|
||||
});
|
||||
|
||||
if (!osmRes.ok) {
|
||||
console.error('Failed to fetch OSM data');
|
||||
let error = await res.json();
|
||||
return { error: error.error };
|
||||
}
|
||||
|
||||
let osmData = (await osmRes.json()) as OpenStreetMapPlace[];
|
||||
|
||||
return {
|
||||
props: {
|
||||
adventures,
|
||||
query,
|
||||
osmData
|
||||
}
|
||||
};
|
||||
}) satisfies PageServerLoad;
|
||||
|
||||
@@ -32,28 +32,6 @@
|
||||
onMount(() => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
query = urlParams.get('query');
|
||||
|
||||
fetchData();
|
||||
});
|
||||
|
||||
async function fetchData() {
|
||||
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`, {
|
||||
headers: {
|
||||
'User-Agent': `AdventureLog / ${appVersion} `
|
||||
}
|
||||
});
|
||||
const data = await res.json();
|
||||
osmResults = data;
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
let res = await fetch(`https://nominatim.openstreetmap.org/search?q=${query}&format=jsonv2`, {
|
||||
headers: {
|
||||
'User-Agent': `AdventureLog / ${appVersion} `
|
||||
}
|
||||
});
|
||||
const data = await res.json();
|
||||
osmResults = data;
|
||||
});
|
||||
|
||||
console.log(data);
|
||||
@@ -73,12 +51,15 @@
|
||||
publicAdventures = publicAdventures.filter(
|
||||
(adventure) => adventure.user_id !== data.user?.pk
|
||||
);
|
||||
|
||||
if (data.props.osmData) {
|
||||
osmResults = data.props.osmData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let adventureToEdit: Adventure;
|
||||
let isEditModalOpen: boolean = false;
|
||||
let isShowingCreateModal: boolean = false;
|
||||
|
||||
function editAdventure(event: CustomEvent<Adventure>) {
|
||||
adventureToEdit = event.detail;
|
||||
@@ -108,7 +89,7 @@
|
||||
<NotFound error={data.error} />
|
||||
{/if}
|
||||
|
||||
{#if myAdventures.length !== 0 && publicAdventures.length !== 0}
|
||||
{#if myAdventures.length !== 0}
|
||||
<h2 class="text-center font-bold text-2xl mb-4">AdventureLog Results</h2>
|
||||
<div class="flex items-center justify-center mt-2 mb-2">
|
||||
<div class="join">
|
||||
|
||||
Reference in New Issue
Block a user