Commit b5f735f8 authored by baesangjune's avatar baesangjune
Browse files

.

parent a683b650
......@@ -5,7 +5,6 @@ import AdminSetting from './AdminSetting'
let QuizBtn = []
function Admin() {
// QnA.length === 0 ? console.log(QnA.length) : QnA = JSON.parse(localStorage.getItem('QnA'))
const [result, setresult] = useState('')
const [QuizBtnCount, setQuizBtnCount] = useState(4)
const indexRef = useRef(0)
......@@ -41,7 +40,6 @@ function Admin() {
} //퀴즈 추가버튼
function handleClickSave(QnAadmin) {
console.log(QnAadmin, indexRef.current)
dbRef.current[indexRef.current] = QnAadmin
localStorage.setItem('QnA', JSON.stringify(dbRef.current))
......
......@@ -16,7 +16,8 @@ function AdminQuiz(props) {
setQuestion(props.data.Q)
setChoose(props.data.Choose)
setAnswer(props.data.A)
},[props.quizNum])
// eslint-disable-next-line
}, [props.quizNum])
const handleChangeQuestion = (event) => {
......@@ -27,6 +28,7 @@ function AdminQuiz(props) {
const handleChangeChoose = (event) => {
savechoose[event.target.id] = event.target.value
setChoose(event.target.value)
console.log(event.target.value)
}
const handleChangeanswer = (event) => {
......@@ -61,6 +63,8 @@ function AdminQuiz(props) {
}
else {
QnAadmin['Choose'] = Object.values(savechoose)
console.log(savechoose)
console.log(QnAadmin.Choose)
QnAadmin['N'] = String(props.quizNum)
props.fn(QnAadmin)
QnAadmin = {}
......@@ -86,7 +90,7 @@ function AdminQuiz(props) {
<input type="radio" checked={false} name="answer" />
</div>
</div>
<input type="text" className="form-control" id='1' value={choose} placeholder="보기를 입력하세요" onChange={handleChangeChoose} />
<input type="text" className="form-control" id='1' value={choose[0]} placeholder="보기를 입력하세요" onChange={handleChangeChoose} />
</div>
{list.map((element) => element)}
<button className="btn btn-outline-secondary btn-sm" onClick={addSelectOption}>+</button>
......
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