Jesuscc9
12/23/2022, 2:47 AMJesuscc9
12/23/2022, 2:47 AMHege
12/23/2022, 5:47 AMHege
12/23/2022, 5:47 AMHege
12/23/2022, 5:47 AMfranco.valdes
12/23/2022, 4:05 PMcoinpimp
12/23/2022, 5:05 PMcoinpimp
12/23/2022, 5:05 PM10000multiplier
12/23/2022, 5:07 PMgaryaustin
12/23/2022, 5:09 PMcoinpimp
12/23/2022, 7:21 PMcoinpimp
12/23/2022, 7:21 PMDavo
12/23/2022, 10:57 PMHege
12/24/2022, 12:05 AMdecruz
12/24/2022, 5:40 AMdecruz
12/24/2022, 5:48 AMeben
12/24/2022, 12:15 PMd33pu
12/24/2022, 2:06 PMDDupasquier
12/24/2022, 9:35 PMjs
import { supabase } from '$lib/supabase';
export async function load({ params }: { params: { page_id: number } }) {
const { data: page, error } = await supabase
.from('pages')
.select(
'id, pageNumber, background, elements: elements (id, elementName, x, y, zIndex, size, type, color, text, pageId)'
)
.eq('id', params.page_id);
// * ==========================================================
// supabase
// .channel('public:elements')
// .on('postgres_changes', { event: 'INSERT', schema: 'public' }, (payload) => {
// page = payload.new;
// })
// .subscribe();
// * ==========================================================
if (error) {
throw new Error(error.message);
}
return {
page
};
}
The commented out code is just the subscription that, with a few changes, I have functioning in the onMount of the +page.svelte.
I know that I could do like a
js
onMount(async() => {
elements = data
})
And then subscribe from the component itself, but I'm hoping to keep this more server side.garyaustin
12/24/2022, 9:46 PMDDupasquier
12/24/2022, 9:47 PMgaryaustin
12/24/2022, 9:51 PMgaryaustin
12/24/2022, 9:52 PMDDupasquier
12/24/2022, 9:54 PMLuv
12/25/2022, 11:09 AMHo3einvb
12/25/2022, 12:14 PMHo3einvb
12/25/2022, 12:15 PM(FOX)
12/25/2022, 4:32 PMHo3einvb
12/25/2022, 4:34 PM(FOX)
12/25/2022, 4:37 PM