mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
feat(code-runner): implement execution result persistence
This commit is contained in:
parent
f63275334e
commit
164eb3f0f5
@ -15,7 +15,7 @@ export default function RunCode({
|
|||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}: RunCodeProps) {
|
}: RunCodeProps) {
|
||||||
const { language, editor } = useCodeEditorState();
|
const { language, editor, setResult } = useCodeEditorState();
|
||||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||||
|
|
||||||
const handleJudge = async () => {
|
const handleJudge = async () => {
|
||||||
@ -25,8 +25,8 @@ export default function RunCode({
|
|||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const judgeResult = await judge(language, code);
|
const result = await judge(language, code);
|
||||||
console.log(judgeResult);
|
setResult(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error occurred while judging the code:");
|
console.error("Error occurred while judging the code:");
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
Loading…
Reference in New Issue
Block a user