Skip to content

Commit 2b00f6a

Browse files
authored
Merge pull request #48 from malikarslanasif131/fix/remove-all-console-log
Remove all console.log statements
2 parents 9152ff3 + d72ef9b commit 2b00f6a

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

src/hooks/useGetStars.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export const useGetStars = () => {
1616
const res = await fetch(
1717
"https://api.github.com/repos/DhanushNehru/CustomCodeEditor"
1818
);
19-
console.log(res.status);
2019
if (res.status === 200) {
2120
const result = await res.json();
2221
setRepositoryStars(result.stargazers_count);

src/pages/EditorComponent.js

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import "../components/css/EditorComponent.css"; // Optional for styling
55
import "@fortawesome/fontawesome-free/css/all.css";
66
import { useSnackbar } from "notistack";
77

8-
const judge0SubmitUrl = process.env.JUDGE0_SUMBISSION_URL || process.env.REACT_APP_RAPID_API_URL;
8+
const judge0SubmitUrl =
9+
process.env.JUDGE0_SUMBISSION_URL || process.env.REACT_APP_RAPID_API_URL;
910
const rapidApiHost = process.env.REACT_APP_RAPID_API_HOST;
1011
const rapidApiKey = process.env.REACT_APP_RAPID_API_KEY;
1112

@@ -75,8 +76,7 @@ function EditorComponent() {
7576
async function submitCode() {
7677
const codeToSubmit = editorRef.current.getValue();
7778

78-
console.log(" Code to submit ", codeToSubmit);
79-
if(codeToSubmit === "") {
79+
if (codeToSubmit === "") {
8080
enqueueSnackbar("Please enter valid code", { variant: "error" });
8181
return;
8282
}
@@ -85,7 +85,7 @@ function EditorComponent() {
8585
method: "POST",
8686
headers: {
8787
"Content-Type": "application/json",
88-
"X-RapidAPI-Key": rapidApiKey ,
88+
"X-RapidAPI-Key": rapidApiKey,
8989
"X-RapidAPI-Host": rapidApiHost,
9090
},
9191
body: JSON.stringify({
@@ -97,51 +97,47 @@ function EditorComponent() {
9797
});
9898

9999
if (!response.ok) {
100-
enqueueSnackbar(`Failed to create submission. Status code: ${response.status}`, { variant: "error" });
101-
return
100+
enqueueSnackbar(
101+
`Failed to create submission. Status code: ${response.status}`,
102+
{ variant: "error" }
103+
);
104+
return;
102105
}
103106

104107
const data = await response.json();
105108
const submissionId = data["token"];
106-
console.log(`Submission created successfully. ID: ${submissionId}`);
107109

108110
setTimeout(() => {
109-
fetch(`${judge0SubmitUrl}/${submissionId}`,
110-
{
111-
method: "GET",
112-
headers:{
113-
"X-RapidAPI-Key": rapidApiKey ,
114-
"X-RapidAPI-Host": rapidApiHost,
115-
}
116-
}
117-
)
111+
fetch(`${judge0SubmitUrl}/${submissionId}`, {
112+
method: "GET",
113+
headers: {
114+
"X-RapidAPI-Key": rapidApiKey,
115+
"X-RapidAPI-Host": rapidApiHost,
116+
},
117+
})
118118
.then((response) => response.json())
119119
.then((data) => {
120-
console.log(" DATA ", data);
121-
console.log("Output:", data.stdout);
122120
setOutput(data.stdout);
123121
})
124122
.catch((error) => {
125-
console.error("Error retrieving output:", error.message);
126-
enqueueSnackbar("Error retrieving output: " + error.message, { variant: "error" });
123+
enqueueSnackbar("Error retrieving output: " + error.message, {
124+
variant: "error",
125+
});
127126
});
128127
}, 2000); // Delay added to give Judge0 some time to process the submission
129128
} catch (error) {
130-
console.error("Error:", error.message);
131129
enqueueSnackbar("Error: " + error.message, { variant: "error" });
132130
}
133131
}
134132

135133
function handleLanguageChange(e) {
136-
console.log("click, ", e.target.value);
137134
setCurrentLanguage(e.target.value);
138135
setOutput("");
139136
setCode(null);
140137
}
141138

142139
return (
143140
<div className="editor-container" style={styles.container}>
144-
145141
{/* Language toggle button (top right corner) */}
146142
<div style={styles.flexBetween}>
147143
{/* Current Language Logo */}
@@ -165,7 +161,7 @@ function EditorComponent() {
165161
{LANGUAGES.map((language, index) => (
166162
<option
167163
key={index}
168-
style={{padding: "0.2em 0.5em"}}
164+
style={{ padding: "0.2em 0.5em" }}
169165
value={language.DEFAULT_LANGUAGE}
170166
>
171167
{language.NAME}

0 commit comments

Comments
 (0)