feat: initial commit
This commit is contained in:
16
src/hooks/use-vocab.ts
Normal file
16
src/hooks/use-vocab.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { supabase } from "@/lib/supabase"
|
||||
|
||||
export function useVocab(topic?: string) {
|
||||
return useQuery({
|
||||
queryKey: ["vocab", topic],
|
||||
queryFn: async () => {
|
||||
let query = supabase.from("vocab").select("*")
|
||||
if (topic) query = query.eq("topic", topic.toLowerCase())
|
||||
const { data, error } = await query
|
||||
if (error) throw error
|
||||
return data
|
||||
},
|
||||
enabled: false, // Enabled during feature implementation
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user