diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2022-05-31 01:09:58 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2022-05-31 01:09:58 +0200 |
| commit | 6ccc6f60fc85e665c8a07a169efbe8d09c9d9e8e (patch) | |
| tree | 87c397af49b7820b5fb2c0fa3037be2ac4a587e8 /src/lib/stores/posts.ts | |
| parent | 852ee620f0a2f6a83cf83eba860ca951b66bb7e2 (diff) | |
Lint, rm unused code
Diffstat (limited to 'src/lib/stores/posts.ts')
| -rw-r--r-- | src/lib/stores/posts.ts | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/lib/stores/posts.ts b/src/lib/stores/posts.ts index f592dca..388eed3 100644 --- a/src/lib/stores/posts.ts +++ b/src/lib/stores/posts.ts @@ -1,23 +1,24 @@ -import { createClient } from '@supabase/supabase-js' -import { single, collection } from './supabase'; +import { createClient } from '@supabase/supabase-js'; +import { single } from './supabase'; import { supabase } from '$lib/config/config'; import type { Post } from '$lib/data/types'; const client = createClient(supabase.url, supabase.key); -export const post = (id: string, withTopic = false) => single<Post>(client - .from('posts') - .select(withTopic ? `*, +export const post = (id: string, withTopic = false) => + single<Post>( + client + .from('posts') + .select( + withTopic + ? `*, topic:topic_id ( * ) - `: '*' ) - .eq('id', id), - null); -export const postsForTopic = (id: string) => collection<Post>(client - .from('posts') - .select('*') - .eq('topic_id', id) - .order('created_at', { ascending: true }), - []); + ` + : '*' + ) + .eq('id', id), + null + ); |