mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-04-19 12:24:46 +00:00
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m18s
24 lines
724 B
TypeScript
24 lines
724 B
TypeScript
import {createClient} from '@/lib/supabase/client'
|
|
|
|
export async function getComments(slug: string) {
|
|
try {
|
|
const supabase = await createClient()
|
|
const {data: comments, error} = await supabase
|
|
.from('comments')
|
|
.select(`
|
|
id,
|
|
content,
|
|
published,
|
|
created_at,
|
|
user:users!inner(id, name, image),
|
|
article:articles!inner(id, title, slug)
|
|
`)
|
|
.eq('article.slug', slug)
|
|
.eq('published', true)
|
|
.order('created_at', {ascending: false})
|
|
|
|
return comments
|
|
} catch (error) {
|
|
console.error(error)
|
|
}
|
|
} |