File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
peerprep/app/q/[question] Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
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 ;
You can’t perform that action at this time.
0 commit comments