File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ export async function addQuestion(body: QuestionFullBody): Promise<StatusBody> {
52
52
`${ process . env . NEXT_PUBLIC_QUESTION_SERVICE } /questions` ,
53
53
{
54
54
method : "POST" ,
55
- body : JSON . stringify ( body ) ,
55
+ body : JSON . stringify ( body ) . replace ( / ( \" d i f f i c u l t y \" : ) \" ( [ 1 - 3 ] ) \" / , `$1$2` ) ,
56
56
headers : {
57
57
"Content-type" : "application/json; charset=UTF-8"
58
58
}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ function NewQuestion({}: Props) {
20
20
description : "" ,
21
21
} ) ;
22
22
23
- const handleTextInput = ( e : ChangeEvent < HTMLInputElement > ) => setFormData ( {
23
+ const handleTextInput = ( e : ChangeEvent < HTMLInputElement | HTMLTextAreaElement > ) => setFormData ( {
24
24
...formData ,
25
25
[ e . target . name ] : e . target . value
26
26
} ) ;
@@ -63,14 +63,14 @@ function NewQuestion({}: Props) {
63
63
return (
64
64
< div >
65
65
< form style = { { color : "black" , padding : "5px" } } onSubmit = { handleSubmission } >
66
- < input type = "text" name = "title" /> < br />
66
+ < input type = "text" name = "title" value = { formData . title } onChange = { handleTextInput } /> < br />
67
67
< input type = "radio" id = "easy" name = "difficulty" value = { 1 } onChange = { handleTextInput } />
68
68
< label htmlFor = "easy" > Easy</ label > < br />
69
69
< input type = "radio" id = "med" name = "difficulty" value = { 2 } onChange = { handleTextInput } />
70
70
< label htmlFor = "med" > Medium</ label > < br />
71
71
< input type = "radio" id = "hard" name = "difficulty" value = { 3 } onChange = { handleTextInput } />
72
72
< label htmlFor = "hard" > Hard</ label > < br />
73
- < textarea name = "description" /> < br />
73
+ < textarea name = "description" value = { formData . description } onChange = { handleTextInput } /> < br />
74
74
{ testCases . map ( ( elem , idx ) => (
75
75
< >
76
76
< input
You can’t perform that action at this time.
0 commit comments