Skip to content

Commit 0fedbdb

Browse files
authored
Merge pull request #512 from Yavuzlar/511-consolelog
console.log's checked.
2 parents adb7beb + e75e1ed commit 0fedbdb

File tree

7 files changed

+25
-41
lines changed

7 files changed

+25
-41
lines changed

frontend/src/components/cards/LanguageProgress.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,6 @@ const LanguageProgress = ({ language, type }) => {
2020
const _md = useMediaQuery((theme) => theme.breakpoints.down("md"));
2121
const _sm = useMediaQuery((theme) => theme.breakpoints.down("sm"));
2222

23-
// switch (type) {
24-
// case "road":
25-
// var icon = roadIcon;
26-
// var data = language.totalRoads;
27-
// break;
28-
// case "lab":
29-
// var icon = labIcon;
30-
// var data = language.totalLabs;
31-
// break;
32-
// }
33-
// console.log("language", language.totalLabs);
34-
3523
// Determine icon and data based on the type
3624
const icon = type === "road" ? roadIcon : labIcon;
3725
const data = type === "road" ? language.totalRoads : language.totalLabs;
@@ -43,7 +31,7 @@ const LanguageProgress = ({ language, type }) => {
4331
sx={{
4432
cursor: language.percentage > 0 ? "pointer" : "",
4533
backgroundColor:
46-
language.percentage === 100 ? theme.palette.success.dark : "",
34+
language.percentage === 100 ? theme.palette.success.dark : "",
4735
"&:hover": {
4836
boxShadow: 8,
4937
},

frontend/src/context/AuthContext.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const AuthProvider = ({ children }) => {
4242
console.log("WebSocket is already connected");
4343
return;
4444
}
45-
console.log("Bağlanılıyor...");
45+
console.log("Connecting...");
4646
ws.current = new WebSocket("ws://localhost/api/v1/private/socket/ws");
4747

4848
ws.current.onopen = () => {
@@ -107,7 +107,7 @@ const AuthProvider = ({ children }) => {
107107
if (ws.current) {
108108
ws.current.close();
109109
ws.current = null;
110-
console.log("WebSocket bağlantısı kapatıldı");
110+
console.log("WebSocket connection closed.");
111111
}
112112
};
113113

@@ -130,16 +130,16 @@ const AuthProvider = ({ children }) => {
130130
};
131131

132132
const createSession = (data) => {
133-
setUser(data) // Set the user data to the state
133+
setUser(data); // Set the user data to the state
134134
webSocket();
135-
localStorage.setItem(authConfig.userDataName, JSON.stringify(data)) // Set the user data to the local storage
136-
}
135+
localStorage.setItem(authConfig.userDataName, JSON.stringify(data)); // Set the user data to the local storage
136+
};
137137

138138
const restoreStorage = () => {
139-
setLoading(false)
140-
setUser(defaultProvider.user)
141-
localStorage.removeItem(authConfig.userDataName)
142-
}
139+
setLoading(false);
140+
setUser(defaultProvider.user);
141+
localStorage.removeItem(authConfig.userDataName);
142+
};
143143

144144
const handleLogout = async () => {
145145
try {
@@ -174,12 +174,12 @@ const AuthProvider = ({ children }) => {
174174
const user = response?.data?.data;
175175

176176
if (user && user?.role) {
177-
createSession(user) // Create a session for the user
178-
setLoading(false) // Set loading to false
177+
createSession(user); // Create a session for the user
178+
setLoading(false); // Set loading to false
179179
setIsInitialized(true);
180180

181181
if (["/login", "/register"].includes(router.pathname)) {
182-
router.push("/")
182+
router.push("/");
183183
}
184184
} else {
185185
setLoading(false);
@@ -232,17 +232,17 @@ const AuthProvider = ({ children }) => {
232232
if (response.status === 200) {
233233
const user = response?.data?.data;
234234

235-
createSession(user) // Create a session for the user
235+
createSession(user); // Create a session for the user
236236
router.push("/");
237237
} else {
238238
showToast("dismiss");
239239
showToast("error", response.data.message);
240-
restoreStorage() // Delete the user data
240+
restoreStorage(); // Delete the user data
241241
}
242242
} catch (error) {
243243
showToast("dismiss");
244244
showToast("error", t(error.response.data.message));
245-
restoreStorage() // Delete the user data
245+
restoreStorage(); // Delete the user data
246246
}
247247
};
248248

frontend/src/pages/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ const Home = () => {
2727
if (!router.isReady) {
2828
return;
2929
}
30-
console.log("qweqwe");
3130

3231
if (localStorage.getItem(authConfig.userDataName) && auth.user?.role) {
3332
const homeRoute = getHomeRoute(auth.user.role);
3433
// Redirect user to Home URL
35-
auth.setLoading(false)
34+
auth.setLoading(false);
3635
router.replace(homeRoute);
3736
} else if (!auth?.loading) {
3837
// Redirect user to Login URL

frontend/src/store/statistics/statisticsSlice.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ const statisticsSlice = createSlice({
143143
})
144144
.addCase(GetUserLevel.rejected, (state, action) => {
145145
state.loading = false;
146-
console.log(action)
147146
state.error = action.payload;
148147
})
149148
.addCase(getUserDevelopment.pending, (state) => {

frontend/src/views/language-road.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const LanguageRoad = ({ language = "", pathId }) => {
5959
const [monacoEditor, setMonacoEditor] = useState("");
6060
const [userCode, setUserCode] = useState("");
6161

62-
6362
const _mdmd = useMediaQuery((theme) => theme.breakpoints.down("mdmd"));
6463

6564
// API data
@@ -97,9 +96,9 @@ const LanguageRoad = ({ language = "", pathId }) => {
9796
// Error 404
9897
useEffect(() => {
9998
if (error?.status == 404) {
100-
router.push('/404')
99+
router.push("/404");
101100
}
102-
}, [error])
101+
}, [error]);
103102

104103
// Set the programming id
105104
useEffect(() => {
@@ -123,7 +122,6 @@ const LanguageRoad = ({ language = "", pathId }) => {
123122
useEffect(() => {
124123
setOutput("");
125124
if (path) {
126-
console.log(path)
127125
if (path.data.data) {
128126
const pathData = path.data.data[0].paths[0];
129127
setExtension(path?.data?.data[0]?.fileExtension);
@@ -198,7 +196,7 @@ const LanguageRoad = ({ language = "", pathId }) => {
198196

199197
useEffect(() => {
200198
getNextPath();
201-
}, [path])
199+
}, [path]);
202200

203201
const handleBeforeUnload = (event) => {
204202
const labPathType = "Road";
@@ -228,7 +226,7 @@ const LanguageRoad = ({ language = "", pathId }) => {
228226

229227
return (
230228
<>
231-
{(!loading && !error) && (
229+
{!loading && !error && (
232230
<Box>
233231
<CustomBreadcrumbs titles={breadcrums} />
234232
<Card

frontend/src/views/settings-admin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ const Settings = () => {
242242
return;
243243
}
244244
try {
245-
console.log("TryGönderilenVeri", passwordSettingsData);
245+
// console.log("TryGönderilenVeri", passwordSettingsData);
246246
} catch (error) {
247-
console.log("Catch Hatası", error);
247+
console.log("Catch Error", error);
248248
}
249249
};
250250

frontend/src/views/settings-user.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ const settings = () => {
240240
return;
241241
}
242242
try {
243-
console.log("TryGönderilenVeri", passwordSettingsData);
243+
// console.log("TryGönderilenVeri", passwordSettingsData);
244244
} catch (error) {
245-
console.log("Catch Hatası", error);
245+
console.log("Catch Error", error);
246246
}
247247
};
248248
const breacrumbs = [

0 commit comments

Comments
 (0)