mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-01 03:05:18 +02:00
Fix critical error
This commit is contained in:
parent
103500b5e1
commit
f98ca62aad
3 changed files with 29 additions and 2 deletions
|
@ -109,7 +109,13 @@ export const actions: Actions = {
|
||||||
formDataToSend.append('description', description || '');
|
formDataToSend.append('description', description || '');
|
||||||
formDataToSend.append('latitude', latitude || '');
|
formDataToSend.append('latitude', latitude || '');
|
||||||
formDataToSend.append('longitude', longitude || '');
|
formDataToSend.append('longitude', longitude || '');
|
||||||
formDataToSend.append('collection', collection || '');
|
|
||||||
|
if (!isNaN(Number(collection))) {
|
||||||
|
if (collection !== null) {
|
||||||
|
formDataToSend.append('collection', collection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (activity_types) {
|
if (activity_types) {
|
||||||
// Filter out empty and duplicate activity types, then trim each activity type
|
// Filter out empty and duplicate activity types, then trim each activity type
|
||||||
const cleanedActivityTypes = Array.from(
|
const cleanedActivityTypes = Array.from(
|
||||||
|
@ -129,6 +135,11 @@ export const actions: Actions = {
|
||||||
formDataToSend.append('link', link || '');
|
formDataToSend.append('link', link || '');
|
||||||
formDataToSend.append('image', image);
|
formDataToSend.append('image', image);
|
||||||
|
|
||||||
|
// log each key-value pair in the FormData
|
||||||
|
for (let pair of formDataToSend.entries()) {
|
||||||
|
console.log(pair[0] + ', ' + pair[1]);
|
||||||
|
}
|
||||||
|
|
||||||
let auth = event.cookies.get('auth');
|
let auth = event.cookies.get('auth');
|
||||||
|
|
||||||
if (!auth) {
|
if (!auth) {
|
||||||
|
|
|
@ -33,7 +33,8 @@ export const load = (async (event) => {
|
||||||
return {
|
return {
|
||||||
lngLat: [adventure.longitude, adventure.latitude] as [number, number],
|
lngLat: [adventure.longitude, adventure.latitude] as [number, number],
|
||||||
name: adventure.name,
|
name: adventure.name,
|
||||||
type: adventure.type
|
type: adventure.type,
|
||||||
|
collection: adventure.collection
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
let showVisited = true;
|
let showVisited = true;
|
||||||
let showPlanned = true;
|
let showPlanned = true;
|
||||||
|
let showCollectionAdventures = false;
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (!showVisited) {
|
if (!showVisited) {
|
||||||
|
@ -33,6 +34,12 @@
|
||||||
const plannedMarkers = data.props.markers.filter((marker) => marker.type === 'planned');
|
const plannedMarkers = data.props.markers.filter((marker) => marker.type === 'planned');
|
||||||
markers = [...markers, ...plannedMarkers];
|
markers = [...markers, ...plannedMarkers];
|
||||||
}
|
}
|
||||||
|
if (!showCollectionAdventures) {
|
||||||
|
markers = markers.filter((marker) => marker.collection === null);
|
||||||
|
} else {
|
||||||
|
const collectionMarkers = data.props.markers.filter((marker) => marker.collection !== null);
|
||||||
|
markers = [...markers, ...collectionMarkers];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let newMarker = [];
|
let newMarker = [];
|
||||||
|
@ -117,6 +124,14 @@
|
||||||
<span class="label-text">Planned</span>
|
<span class="label-text">Planned</span>
|
||||||
<input type="checkbox" bind:checked={showPlanned} class="checkbox checkbox-primary" />
|
<input type="checkbox" bind:checked={showPlanned} class="checkbox checkbox-primary" />
|
||||||
</label>
|
</label>
|
||||||
|
<label class="label cursor-pointer">
|
||||||
|
<span class="label-text">Collection Adventures</span>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={showCollectionAdventures}
|
||||||
|
class="checkbox checkbox-primary"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
{#if newMarker.length > 0}
|
{#if newMarker.length > 0}
|
||||||
<button type="button" class="btn btn-primary mb-2" on:click={() => (createModalOpen = true)}
|
<button type="button" class="btn btn-primary mb-2" on:click={() => (createModalOpen = true)}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue