Skip to content

Commit

Permalink
refactor: refactor code for loading state
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeMaster17 committed Sep 4, 2024
1 parent 50c3811 commit b43c959
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/pages/CodingPlayground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const CodingPlayground = () => {
const handleSubmit = useCallback(async () => {
setLoading(true);


try {
const payload = {
language: selectedLanguage.toLowerCase() === "c++" ? "cpp" : "py",
Expand Down Expand Up @@ -86,13 +87,12 @@ const CodingPlayground = () => {

setTimeout(() => {
clearInterval(intervalId);
setLoading(false);
setStatus("Timelimit exceeded");
}, 10000);

} catch (error) {
setOutput("An error occurred while running the code.");
} finally {
setLoading(false);
}
}, [selectedLanguage, userCode, inputValue, jobId]);

Expand Down

0 comments on commit b43c959

Please sign in to comment.