1 import { createClient } from '@supabase/supabase-js'
2 import { single, collection } from './supabase';
3 import { supabase } from '$lib/config/config';
5 import type { Post } from '$lib/data/types';
7 const client = createClient(supabase.url, supabase.key);
9 export const post = (id: string, withTopic = false) => single<Post>(client
11 .select(withTopic ? `*,
18 export const postsForTopic = (id: string) => collection<Post>(client
22 .order('created_at', { ascending: true }),