mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-25 07:49:37 +02:00
Being back /all view for map AdventureLink
This commit is contained in:
parent
f354cd1ffe
commit
ed37ad45e4
4 changed files with 23 additions and 23 deletions
|
@ -19,14 +19,14 @@
|
|||
if (modal) {
|
||||
modal.showModal();
|
||||
}
|
||||
let res = await fetch(`/api/adventures/?include_collections=false`, {
|
||||
let res = await fetch(`/api/adventures/all/?include_collections=false`, {
|
||||
method: 'GET'
|
||||
});
|
||||
|
||||
const newAdventures = await res.json();
|
||||
|
||||
if (res.ok && adventures) {
|
||||
adventures = newAdventures.results;
|
||||
adventures = newAdventures;
|
||||
}
|
||||
isLoading = false;
|
||||
});
|
||||
|
|
|
@ -736,11 +736,13 @@ it would also work to just use on:click on the MapLibre component itself. -->
|
|||
timeZone: 'UTC'
|
||||
})}
|
||||
</p>
|
||||
<p>
|
||||
{new Date(visit.end_date).toLocaleDateString(undefined, {
|
||||
timeZone: 'UTC'
|
||||
})}
|
||||
</p>
|
||||
{#if visit.end_date}
|
||||
<p>
|
||||
{new Date(visit.end_date).toLocaleDateString(undefined, {
|
||||
timeZone: 'UTC'
|
||||
})}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<div>
|
||||
<button
|
||||
|
|
|
@ -8,7 +8,7 @@ export const load = (async (event) => {
|
|||
if (!event.locals.user) {
|
||||
return redirect(302, '/login');
|
||||
} else {
|
||||
let visitedFetch = await fetch(`${endpoint}/api/adventures/`, {
|
||||
let visitedFetch = await fetch(`${endpoint}/api/adventures/all/?include_collections=true`, {
|
||||
headers: {
|
||||
Cookie: `${event.cookies.get('auth')}`
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export const load = (async (event) => {
|
|||
let visited: Adventure[] = [];
|
||||
try {
|
||||
let api_result = await visitedFetch.json();
|
||||
visited = api_result.results as Adventure[];
|
||||
visited = api_result as Adventure[];
|
||||
if (!Array.isArray(visited) || visited.length === 0 || !visited) {
|
||||
throw new Error('Visited adventures response is not an array');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue