Commit 3411ed91 authored by Yoon, Daeki's avatar Yoon, Daeki 😅
Browse files

퀴즈 작성후 복귀

parent b54f3c44
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>
); );
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment