From 164eb3f0f5b1ddf98770a9b38d08b9c05fa088bf Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Sat, 1 Mar 2025 21:23:44 +0800 Subject: [PATCH] feat(code-runner): implement execution result persistence --- src/components/run-code.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/run-code.tsx b/src/components/run-code.tsx index d1b920c..4b29e54 100644 --- a/src/components/run-code.tsx +++ b/src/components/run-code.tsx @@ -15,7 +15,7 @@ export default function RunCode({ className, ...props }: RunCodeProps) { - const { language, editor } = useCodeEditorState(); + const { language, editor, setResult } = useCodeEditorState(); const [isLoading, setIsLoading] = useState(false); const handleJudge = async () => { @@ -25,8 +25,8 @@ export default function RunCode({ setIsLoading(true); try { - const judgeResult = await judge(language, code); - console.log(judgeResult); + const result = await judge(language, code); + setResult(result); } catch (error) { console.error("Error occurred while judging the code:"); console.error(error);