-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';
-export const getTag = (id: string) => store({ key: 'tag', query: GET_TAG, variables: { id } });
+import type { Tag } from '$lib/data/types';
+
+const client = createClient(supabase.url, supabase.key);
+
+export const tagsForTopic = (id: string) => collection<Tag>(client
+ .from('topic_tags')
+ .select('*')
+ .eq('topic_id', id),
+ []);