mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-31 02:39:38 +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('latitude', latitude || '');
|
||||
formDataToSend.append('longitude', longitude || '');
|
||||
formDataToSend.append('collection', collection || '');
|
||||
|
||||
if (!isNaN(Number(collection))) {
|
||||
if (collection !== null) {
|
||||
formDataToSend.append('collection', collection);
|
||||
}
|
||||
}
|
||||
|
||||
if (activity_types) {
|
||||
// Filter out empty and duplicate activity types, then trim each activity type
|
||||
const cleanedActivityTypes = Array.from(
|
||||
|
@ -129,6 +135,11 @@ export const actions: Actions = {
|
|||
formDataToSend.append('link', link || '');
|
||||
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');
|
||||
|
||||
if (!auth) {
|
||||
|
|
|
@ -33,7 +33,8 @@ export const load = (async (event) => {
|
|||
return {
|
||||
lngLat: [adventure.longitude, adventure.latitude] as [number, number],
|
||||
name: adventure.name,
|
||||
type: adventure.type
|
||||
type: adventure.type,
|
||||
collection: adventure.collection
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
let showVisited = true;
|
||||
let showPlanned = true;
|
||||
let showCollectionAdventures = false;
|
||||
|
||||
$: {
|
||||
if (!showVisited) {
|
||||
|
@ -33,6 +34,12 @@
|
|||
const plannedMarkers = data.props.markers.filter((marker) => marker.type === 'planned');
|
||||
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 = [];
|
||||
|
@ -117,6 +124,14 @@
|
|||
<span class="label-text">Planned</span>
|
||||
<input type="checkbox" bind:checked={showPlanned} class="checkbox checkbox-primary" />
|
||||
</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}
|
||||
<button type="button" class="btn btn-primary mb-2" on:click={() => (createModalOpen = true)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue