Skip to content

Commit 2082911

Browse files
committed
Add rudimentary Question page
Only handles errors right now - will implement layout soon.
1 parent 6b33560 commit 2082911

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

peerprep/app/q/[question]/page.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { fetchQuestion } from '@/api/gateway';
2+
import { Question as QnType, ErrorBody, isError } from "@/api/structs";
3+
import ErrorBlock from '@/components/shared/ErrorBlock';
4+
import React from 'react'
5+
6+
type Props = {
7+
params: {
8+
question: string
9+
}
10+
}
11+
12+
const questionBlock = (question: QnType) => (
13+
<>
14+
<h1>It works?</h1>
15+
<p>{question.description}</p>
16+
</>
17+
);
18+
19+
async function Question({ params }: Props) {
20+
const question = await fetchQuestion(params.question);
21+
22+
return (
23+
<div className="from-white">
24+
{isError(question) ? <ErrorBlock err={question as ErrorBody}/> : questionBlock(question as QnType)}
25+
</div>
26+
)
27+
}
28+
29+
export default Question;

0 commit comments

Comments
 (0)