Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
quiz-competition
Commits
3411ed91
Commit
3411ed91
authored
Oct 02, 2020
by
Yoon, Daeki
😅
Browse files
퀴즈 작성후 복귀
parent
b54f3c44
Changes
1
Show whitespace changes
Inline
Side-by-side
src/client/src/quiz/NewQuiz.jsx
View file @
3411ed91
import
React
,
{
useState
}
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
Link
}
from
'
react-router-dom
'
import
Button
from
"
react-bootstrap/Button
"
;
import
Button
from
"
react-bootstrap/Button
"
;
import
Form
from
"
react-bootstrap/Form
"
;
import
Form
from
"
react-bootstrap/Form
"
;
import
Col
from
"
react-bootstrap/Col
"
;
import
Col
from
"
react-bootstrap/Col
"
;
import
Modal
from
"
react-bootstrap/Modal
"
;
import
authHelpers
from
"
../auth/auth-helpers
"
;
import
authHelpers
from
"
../auth/auth-helpers
"
;
import
{
create
}
from
"
./api-quiz
"
;
import
{
create
}
from
"
./api-quiz
"
;
// import NewProblem from "./NewProblem";
// import NewProblem from "./NewProblem";
...
@@ -10,6 +12,8 @@ import Problem from "./Problem";
...
@@ -10,6 +12,8 @@ import Problem from "./Problem";
function
NewQuiz
()
{
function
NewQuiz
()
{
const
[
title
,
setTitle
]
=
useState
(
''
)
const
[
title
,
setTitle
]
=
useState
(
''
)
const
[
problems
,
setProblems
]
=
useState
([])
const
[
problems
,
setProblems
]
=
useState
([])
const
[
show
,
setShow
]
=
useState
(
false
)
const
[
quiz
,
setQuiz
]
=
useState
({})
const
jwt
=
authHelpers
.
isAuthenticated
();
const
jwt
=
authHelpers
.
isAuthenticated
();
...
@@ -39,6 +43,8 @@ function NewQuiz() {
...
@@ -39,6 +43,8 @@ function NewQuiz() {
console
.
log
(
data
.
error
);
console
.
log
(
data
.
error
);
}
else
{
}
else
{
console
.
log
(
data
);
console
.
log
(
data
);
setQuiz
(
data
)
setShow
(
true
)
}
}
}
}
);
);
...
@@ -58,6 +64,19 @@ function NewQuiz() {
...
@@ -58,6 +64,19 @@ function NewQuiz() {
}
}
<
NewQuizProblem
addProblem
=
{
addProblem
}
/>
<
NewQuizProblem
addProblem
=
{
addProblem
}
/>
<
Button
onClick
=
{
clickSubmit
}
>
퀴즈 저장
</
Button
>
<
Button
onClick
=
{
clickSubmit
}
>
퀴즈 저장
</
Button
>
<
Modal
show
=
{
show
}
>
<
Modal
.
Header
>
<
Modal
.
Title
>
New Quiz
</
Modal
.
Title
>
</
Modal
.
Header
>
<
Modal
.
Body
>
New Quiz successfully created.
</
Modal
.
Body
>
<
Modal
.
Footer
>
<
Link
to
=
{
`/quiz/
${
quiz
.
_id
}
`
}
>
<
Button
>
Go to quiz
</
Button
>
</
Link
>
</
Modal
.
Footer
>
</
Modal
>
</
div
>
</
div
>
);
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment