]> git.r.bdr.sh - rbdr/forum/blobdiff - src/lib/stores/tags.ts
Use supabase
[rbdr/forum] / src / lib / stores / tags.ts
index c96da2d0a8c92f7c042968c01716b8f89229618f..0b528e8f0ed9b3ecbe47fafb1ebcdb60a4aa7917 100644 (file)
@@ -1,6 +1,13 @@
-import { store } from './apollo';
-import { GET_TAG } from '$lib/data/queries';
+import { createClient } from '@supabase/supabase-js'
+import { collection } from './supabase';
+import { supabase } from '$lib/config/config';
 
 import type { Tag } from '$lib/data/types';
 
-export const getTag = (id: string) => store<Tag>({ key: 'tag', query: GET_TAG, variables: { id } });
+const client = createClient(supabase.url, supabase.key);
+
+export const tagsForTopic = (id: string) => collection<Tag>(client
+  .from('topic_tags')
+  .select('*')
+  .eq('topic_id', id),
+  []);