export default function Post() {
const { id } = useRouter().query;
const postByIdQuery = trpc.post?.byId.useQuery({
userId: session?.user?.id,
id: String(id),
});
const { data: post } = postByIdQuery
if (!post) {
return <Error statusCode=404>
}
return (
<h1>{post.title}</h1>
<p>{post.desc}</p>
)
}
export default function Post() {
const { id } = useRouter().query;
const postByIdQuery = trpc.post?.byId.useQuery({
userId: session?.user?.id,
id: String(id),
});
const { data: post } = postByIdQuery
if (!post) {
return <Error statusCode=404>
}
return (
<h1>{post.title}</h1>
<p>{post.desc}</p>
)
}