init commit,
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
'use client'
|
||||
|
||||
import useSupabaseBrowser from '@/utils/supabase-browser'
|
||||
import { getCountryById } from '@/queries/get-country-by-id'
|
||||
import { useQuery } from '@supabase-cache-helpers/postgrest-react-query'
|
||||
|
||||
export default function CountryPage({ params }: { params: { id: number } }) {
|
||||
const supabase = useSupabaseBrowser()
|
||||
const {
|
||||
data: country,
|
||||
isLoading,
|
||||
isError,
|
||||
} = useQuery(getCountryById(supabase, params.id))
|
||||
|
||||
if (isLoading) {
|
||||
return <div>Loading...</div>
|
||||
}
|
||||
|
||||
if (isError || !country) {
|
||||
return <div>Error</div>
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>{country.name}</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user