Skip to content

Commit

Permalink
[fix] miniQuiz 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
subsub-e committed Aug 16, 2024
1 parent eb46c53 commit a2b7d16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
11 changes: 0 additions & 11 deletions admin/src/hooks/useFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ function useFetch(api, params) {
if (typeof response === 'object') {
if (response.code === 'UNAUTHORIZED') {
navigate('/error');
} else if (initialData.code === 'NO_QUIZ_INFO') {
setQuizData({
quizId: '0',
quizDescription: '',
quizQuestions: {
1: '',
2: '',
3: '',
4: '',
},
});
} else {
setData(response);
}
Expand Down
15 changes: 14 additions & 1 deletion admin/src/pages/miniQuiz/MiniQuiz.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ function MiniQuiz() {

useEffect(() => {
if (initialData) {
setQuizData(initialData);
if (initialData.code === 'NO_QUIZ_INFO') {
setQuizData({
quizId: '0',
quizDescription: '',
quizQuestions: {
1: '',
2: '',
3: '',
4: '',
},
});
} else {
setQuizData(initialData);
}
}
}, [initialData]);

Expand Down

0 comments on commit a2b7d16

Please sign in to comment.