diff --git a/frontend/src/lib/components/NewCollection.svelte b/frontend/src/lib/components/NewCollection.svelte index ede6fba..7ba4cee 100644 --- a/frontend/src/lib/components/NewCollection.svelte +++ b/frontend/src/lib/components/NewCollection.svelte @@ -56,10 +56,16 @@ let id = data[1]; let user_id = data[2]; - console.log(newCollection); - dispatch('create', newCollection); - addToast('success', 'Collection created successfully!'); - close(); + if (id !== undefined && user_id !== undefined) { + newCollection.id = id; + newCollection.user_id = user_id; + console.log(newCollection); + dispatch('create', newCollection); + addToast('success', 'Collection created successfully!'); + close(); + } else { + addToast('error', 'Error creating collection'); + } } } } diff --git a/frontend/src/lib/components/TransportationCard.svelte b/frontend/src/lib/components/TransportationCard.svelte index 8427c8b..fbe7233 100644 --- a/frontend/src/lib/components/TransportationCard.svelte +++ b/frontend/src/lib/components/TransportationCard.svelte @@ -7,7 +7,7 @@ import FileDocumentEdit from '~icons/mdi/file-document-edit'; import { goto } from '$app/navigation'; - import type { Collection, Transportation } from '$lib/types'; + import type { Collection, Transportation, User } from '$lib/types'; import { addToast } from '$lib/toasts'; import Plus from '~icons/mdi/plus'; @@ -15,6 +15,7 @@ const dispatch = createEventDispatcher(); export let transportation: Transportation; + export let user: User | null = null; function editTransportation() { dispatch('edit', transportation); @@ -51,13 +52,15 @@ {#if transportation.date} {new Date(transportation.date).toLocaleString()} {/if} -