diff --git a/src/client/src/core/Warning.jsx b/src/client/src/core/Warning.jsx index 760486a17b7d0ab48d3f00a44b2b4d7491ece73f..b1e23f505ccf8133fb8fe7f963fe63dcf27bdfb7 100644 --- a/src/client/src/core/Warning.jsx +++ b/src/client/src/core/Warning.jsx @@ -8,7 +8,6 @@ import { useEffect } from "react"; import Card from "react-bootstrap/esm/Card"; import { Link, Redirect } from 'react-router-dom'; - function Warning() { const [data, setData] = useState({ name: "", }) const [courses, setCourses] = useState([{ name: "", description: "", code: "", }]) @@ -48,7 +47,6 @@ function Warning() { }; return (
- {console.log("quiz=",quiz)}

Korea University

diff --git a/src/client/src/quiz/Problems.jsx b/src/client/src/quiz/Problems.jsx index 1f465413e34816436594342217fffecd89f449fe..1a1f8041b7482ee2e9afc1e85f6ce38dd78e597f 100644 --- a/src/client/src/quiz/Problems.jsx +++ b/src/client/src/quiz/Problems.jsx @@ -1,20 +1,40 @@ // import React, { useState, useEffect } from 'react' // import { Link, Redirect } from 'react-router-dom'; // import Timer from 'react-compound-timer'; // 타이머쓰기위해 import +// import quiz from './Quiz' // function Problems() { -// let Time = 0 -// if (JSON.parse(localStorage.getItem("Set")) === null) { -// Time = 30010 -// } -// else { -// Time = Number(JSON.parse(localStorage.getItem("Set"))[0].Time) -// } +// const [data, setData] = useState({ name: "", }) +// const [courses, setCourses] = useState([{ name: "", description: "", code: "", }]) +// const [values, setValues] = useState({ +// title: "", +// problems: [], +// show: false, +// startAt: "", +// endAt: "", +// course: "", +// }); +// const { authUser } = useAuth() + +// useEffect(() => { +// const abortController = new AbortController() +// const signal = abortController.signal +// readUser(authUser.user._id, { t: authUser.token }).then(res => { +// setData(res); +// }) +// list(signal).then(res => { +// setCourses(res) +// }) +// }, []); + +// let Time = 30010 + + // const [question, setQuestion] = useState({ -// ...localQnA[0] + // }) // const [selected, setSelected] = useState("") //선택한 답을 보여줄 것 @@ -112,91 +132,87 @@ // // ) - -// // return ( -// //
-// // ) // } // export default Problems -import React, { useEffect, useState } from "react"; -import { Link, useParams } from 'react-router-dom'; -import Card from "react-bootstrap/Card"; -import Button from "react-bootstrap/Button"; -import { listByUserId } from "./api-quiz"; -import authHelpers from "../auth/auth-helpers"; - -function Problem({ problem, number, onUpdate, onRemove }) { - - const { userId } = useParams(); - const [quizzes, setQuizzes] = useState([]); - - const jwt = authHelpers.isAuthenticated(); - - useEffect(() => { - const abortController = new AbortController(); - const signal = abortController.signal; - - listByUserId({ userId: userId }, { t: jwt.token }, signal).then((data) => { - if (data.error) { - console.log(data.error); - } else { - // console.log(data); - setQuizzes(data); - } - }); - - return () => { - abortController.abort(); - }; - }, [userId]); - - return ( -
{console.log(quizzes)})
- //
- - // {quizzes.map((quiz, i) => { - // return ( - // - // // - // - // - // {i + 1}번. {quiz} - // - // Answers - // {problem.answers.map((answer, index) => { - // return {answer}; - // })} - // - // - // - // - // - // - // - // ); - // })} - //
- - // - // - // - // {number + 1}번. {problem.question} - // - // Answers - // {problem.answers.map((answer, index) => { - // return {answer}; - // })} - // - // - // - // - // - // - ); -} - -export default Problem; +// // import React, { useEffect, useState } from "react"; +// // import { Link, useParams } from 'react-router-dom'; +// // import Card from "react-bootstrap/Card"; +// // import Button from "react-bootstrap/Button"; +// // import { listByUserId } from "./api-quiz"; +// // import authHelpers from "../auth/auth-helpers"; + +// // function Problems() { + +// // const { userId } = useParams(); +// // const [quizzes, setQuizzes] = useState([]); + +// // const jwt = authHelpers.isAuthenticated(); + +// // useEffect(() => { +// // const abortController = new AbortController(); +// // const signal = abortController.signal; + +// // listByUserId({ userId: userId }, { t: jwt.token }, signal).then((data) => { +// // if (data.error) { +// // console.log(data.error); +// // } else { +// // // console.log(data); +// // setQuizzes(data); +// // } +// // }); + +// // return () => { +// // abortController.abort(); +// // }; +// // }, [userId]); + +// // return ( +// //
{console.log(quizzes)})
+// // //
+ +// // // {quizzes.map((quiz, i) => { +// // // return ( +// // // +// // // // +// // // +// // // +// // // {i + 1}번. {quiz} +// // // +// // // Answers +// // // {problem.answers.map((answer, index) => { +// // // return {answer}; +// // // })} +// // // +// // // +// // // +// // // +// // // +// // // +// // // +// // // ); +// // // })} +// // //
+ +// // // +// // // +// // // +// // // {number + 1}번. {problem.question} +// // // +// // // Answers +// // // {problem.answers.map((answer, index) => { +// // // return {answer}; +// // // })} +// // // +// // // +// // // +// // // +// // // +// // // +// // ); +// // } + +// // export default Problems; diff --git a/src/client/src/quiz/Quizzes.jsx b/src/client/src/quiz/Quizzes.jsx index aea781e95d3b501a7292bf712deeda6f790c8117..1ba5e84cfefccdbaca49d981c2a8a79835459e78 100644 --- a/src/client/src/quiz/Quizzes.jsx +++ b/src/client/src/quiz/Quizzes.jsx @@ -16,9 +16,9 @@ function Quizzes() { listByUserId({ userId: userId }, { t: jwt.token }, signal).then((data) => { if (data.error) { - console.log(data.error); + console.log('dataerror=',data.error); } else { - // console.log(data); + console.log('data=',data); setQuizzes(data); } }); @@ -31,7 +31,6 @@ function Quizzes() { return (
All Quizzes Here - {console.log("quizzes=", quizzes)} {quizzes.map((quiz, i) => { return (