Skip to content

Commit

Permalink
hotfix: fcfs 퀴즈 제출 시 발생한 서버 에러 핸들링
Browse files Browse the repository at this point in the history
  • Loading branch information
nim-od committed Aug 23, 2024
1 parent 7178295 commit d03622d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/user/src/components/shared/modal/fcfs/ErrorStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export default function ErrorStep({ error, resetErrorBoundary }: FallbackProps)
</p>
</InfoStep>
);
case 1234:
return (
<InfoStep>
<p className="text-heading-10 font-medium">퀴즈 제출 중 오류가 발생했어요</p>
</InfoStep>
);
default:
return (
<InfoStep>
Expand Down
10 changes: 8 additions & 2 deletions packages/user/src/components/shared/modal/fcfs/QuizStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import OptionButton from 'src/components/common/OptionButton.tsx';
import PendingStep from 'src/components/shared/modal/PendingStep.tsx';
import useGetFCFSQuiz from 'src/hooks/query/useGetFCFSQuiz.ts';
import useSubmitFCFSQuiz, { SubmitFCFSQuizResponse } from 'src/hooks/query/useSubmitFCFSQuiz.ts';
import CustomError from 'src/utils/error.ts';

export type ResultStepType = ReturnType<typeof getResultStepFromStatus>;
interface QuizStepProps {
onStepChange: (step: ResultStepType) => void;
onStepChange: (step: ResultStepType | '') => void;
}

export default function QuizStep({ onStepChange }: QuizStepProps) {
Expand All @@ -19,7 +20,12 @@ export default function QuizStep({ onStepChange }: QuizStepProps) {
const handleSubmit = (answer: number) =>
submitAnswer(
{ answer },
{ onSuccess: (response) => onStepChange(getResultStepFromStatus(response)) },
{
onSuccess: (response) => onStepChange(getResultStepFromStatus(response)),
onError: (error) => {
throw new CustomError(error.message, 1234);
},
},
);

if (isPending) {
Expand Down

0 comments on commit d03622d

Please sign in to comment.