manifold/web/pages/contract/[contractId].tsx

28 lines
600 B
TypeScript
Raw Normal View History

2021-12-09 21:31:02 +00:00
import { useRouter } from 'next/router'
2021-12-09 22:05:55 +00:00
import { useContract } from '../../hooks/use-contract'
import { useUser } from '../../hooks/use-user'
2021-12-09 21:31:02 +00:00
export default function ContractPage() {
2021-12-09 22:05:55 +00:00
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>
)
}