manifold/web/pages/contract/[contractId].tsx
2021-12-09 16:05:55 -06:00

28 lines
600 B
TypeScript

import { useRouter } from 'next/router'
import { useContract } from '../../hooks/use-contract'
import { useUser } from '../../hooks/use-user'
export default function ContractPage() {
const user = useUser()
const router = useRouter()
const { contractId } = router.query as { contractId: string }
const contract = useContract(contractId)
if (contract === 'loading') {
return <div>Loading...</div>
}
if (contract === null) {
return <div>Contract not found...</div>
}
return (
<div>
<div>{contract.id}</div>
<div>{contract.question}</div>
</div>
)
}