Ape R Us
04/11/2022, 5:28 PMconst { data: events, error } = await supabase
.from('event')
.select('name,organiser, event_branding(*)')
.eq('is_live', 'false');
and im getting the data and can pass the props to a component after the each block like this
{#each events as event}
<EventCard {...event} />
{/each}
however the coloums in the event_branding table is also an array, how do i get that out in the new component .
sent a pick as wellNeedle
04/11/2022, 5:28 PM/title
command!
We have solved your problem?
Click the button below to archive it.Ape R Us
04/11/2022, 5:29 PMApe R Us
04/11/2022, 5:36 PMsilentworks
04/11/2022, 7:55 PMevent_branding
table that are related to the event
?Needle
04/11/2022, 7:55 PMApe R Us
04/12/2022, 12:48 AMApe R Us
04/12/2022, 12:48 AMApe R Us
04/12/2022, 12:58 AM/e/{slug}
but because the event_branding is a join table i had to do a 2nd each block as shown in the pic aboveApe R Us
04/12/2022, 12:59 AMApe R Us
04/12/2022, 1:01 AM/e/[url]
link to go to the page ``href=[/e/${branding.url}
]``
endpoint file
import supabase from '$lib/db';
export const get = async ({ params }) => {
try {
const url = params.url;
const { data: event, error } = await supabase
.from('event')
.select('*, event_branding(*),event_general(*)')
.match({ url })
.single();
if (error) throw error;
console.log(event);
return {
body: {
event
}
};
} catch (e) {
console.log({ e });
}
};