diff --git a/code/client/src/components/CreateGoal.js b/code/client/src/components/CreateGoal.js index 10d7b7248..a7c27444f 100644 --- a/code/client/src/components/CreateGoal.js +++ b/code/client/src/components/CreateGoal.js @@ -38,7 +38,6 @@ function ManageGoal() { }) .catch((err) => { setError("Error fetching goal data. Try refreshing."); - console.log(err); }); } }; @@ -75,11 +74,9 @@ function ManageGoal() { await apiClient.post("/api/goals", goalData, { headers: { Authorization: `Bearer ${token}` }, }); - console.log("Updating goal"); setSuccessMessage("Goal updated!"); fetchGoalData(); } catch (err) { - console.log("Error updating goal", err); setErrorMessage("Error: Failed to update goal. Please try again"); } }; diff --git a/code/client/src/components/DailyData.js b/code/client/src/components/DailyData.js index ab961fe68..e1d72bb9e 100644 --- a/code/client/src/components/DailyData.js +++ b/code/client/src/components/DailyData.js @@ -117,11 +117,9 @@ function DailyData() { headers: { Authorization: `Bearer ${token}` }, // Pass token } ); - console.log("Daily entry processed"); setSuccessMessage("Daily entry successful!"); } } catch (err) { - console.log("Error submitting daily entry", err); setErrorMessage("Error: Failed to submit daily entry. Please try again"); } }; diff --git a/code/client/src/components/Home.js b/code/client/src/components/Home.js index 1d4470107..6b1eea846 100644 --- a/code/client/src/components/Home.js +++ b/code/client/src/components/Home.js @@ -44,7 +44,6 @@ function Home({ initialData = [] }) { }) .catch((err) => { setError("Error fetching profile data. Try refreshing."); - console.log(err); }); if (initialData.length === 0) { @@ -60,7 +59,6 @@ function Home({ initialData = [] }) { setDayLabels(days) }) .catch((err) => { - console.error(err); setError("Error fetching last seven days data."); }); } else { @@ -78,7 +76,6 @@ function Home({ initialData = [] }) { setGoalData(res.data); }) .catch((err) => { - console.error(err); setError("Error fetching goal data."); }); } diff --git a/code/client/src/components/ManageDailyData.js b/code/client/src/components/ManageDailyData.js index 431e5636b..aba9bf03c 100644 --- a/code/client/src/components/ManageDailyData.js +++ b/code/client/src/components/ManageDailyData.js @@ -25,11 +25,9 @@ function ManageDailyData() { }) .then((res) => { setData(res.data); - console.log(data) }) .catch((err) => { setError("Error fetching data. Try refreshing."); - console.log(err); }); } }; @@ -63,7 +61,6 @@ function ManageDailyData() { }) .catch((err) => { setError("Error fetching data. Try refreshing."); - console.log(err); }); } } diff --git a/code/client/src/components/ManageProfile.js b/code/client/src/components/ManageProfile.js index 5874ddaed..517977400 100644 --- a/code/client/src/components/ManageProfile.js +++ b/code/client/src/components/ManageProfile.js @@ -52,7 +52,6 @@ function ManageProfile() { }) .catch((err) => { setError("Error fetching profile data. Try refreshing."); - console.log(err); }); } }, []); @@ -99,10 +98,8 @@ function ManageProfile() { try { await apiClient.post("/api/users/manage-profile", profileData); - console.log("Updating profile"); setSuccessMessage("Profile updated!"); } catch (err) { - console.log("Error updating profile", err); setErrorMessage("Error: Failed to update profile. Please try again"); } }; diff --git a/code/client/src/utils/dailyDataUtils.js b/code/client/src/utils/dailyDataUtils.js index 198bc3b46..29274c4f3 100644 --- a/code/client/src/utils/dailyDataUtils.js +++ b/code/client/src/utils/dailyDataUtils.js @@ -17,5 +17,4 @@ function getLastSevenDaysFormatted() { } // Example usage -const lastSevenDays = getLastSevenDaysFormatted(); -console.log(lastSevenDays); \ No newline at end of file +const lastSevenDays = getLastSevenDaysFormatted(); \ No newline at end of file diff --git a/code/server/controllers/dailyEntryController.js b/code/server/controllers/dailyEntryController.js index aa235388d..d78945c9d 100644 --- a/code/server/controllers/dailyEntryController.js +++ b/code/server/controllers/dailyEntryController.js @@ -79,7 +79,6 @@ exports.enterDailyData = async (req, res) => { return res.status(201).json({ message: "Daily entry created successfully!" }); } } catch (error) { - console.log(error) res.status(500).json({ message: "Error creating or updating daily entry" }); } }; @@ -117,7 +116,6 @@ exports.viewDailyData = async (req,res) => { res.json(userDailyData); } catch (error) { - console.error(error); res.status(500).json({ message: 'Server error' }); } } @@ -219,7 +217,6 @@ exports.lastSevenDays = async (req, res) => { }); } catch (error) { - console.error(error); res.status(500).json({ message: 'Error getting last seven days of data' }); } }; \ No newline at end of file diff --git a/code/server/controllers/goalController.js b/code/server/controllers/goalController.js index d3d66117b..8cbb9aad5 100644 --- a/code/server/controllers/goalController.js +++ b/code/server/controllers/goalController.js @@ -39,7 +39,6 @@ exports.getGoal = async (req, res) => { res.status(200).json(userGoal); } catch (error) { - console.error('Error fetching goal:', error); res.status(500).json({ message: 'Error fetching goal' }); } }; @@ -81,7 +80,6 @@ exports.createOrUpdateGoal = async (req, res) => { await userGoal.save(); res.status(201).json({ message: 'Goal updated successfully', userGoal: userGoal }); } catch (error) { - console.error('Error updating goal:', error); res.status(500).json({ message: 'Error updating goal' }); } }; \ No newline at end of file diff --git a/code/server/controllers/userController.js b/code/server/controllers/userController.js index bffd6fd85..12257090b 100644 --- a/code/server/controllers/userController.js +++ b/code/server/controllers/userController.js @@ -5,11 +5,9 @@ const jwt = require('jsonwebtoken'); // View all users exports.viewUsers = async (req, res) => { try { - console.log('Fetching all users...'); const allUsers = await User.find({}); res.json(allUsers); } catch (error) { - console.error(error); res.status(500).json({ message: 'Error retrieving users' }); } }; @@ -43,7 +41,6 @@ exports.manageProfile = async (req, res) => { res.json(userProfile); } catch (error) { - console.error(error); res.status(500).json({ message: 'Server error' }); } }; @@ -55,7 +52,6 @@ exports.updateProfile = async (req, res) => { const userProfile = await User.findOne({ userId: Number(userId) }); if (!userProfile) { - console.log('User not found for userId:', userId); return res.status(404).json({ message: 'User not found' }); } @@ -79,7 +75,6 @@ exports.updateProfile = async (req, res) => { await userProfile.save(); res.status(200).json({ message: 'Profile updated successfully', userProfile }); } catch (error) { - console.error(error); res.status(500).json({ message: 'Error updating profile' }); } }; @@ -111,7 +106,6 @@ exports.createUser = async (req, res) => { await newUser.save(); res.status(201).json({ message: 'User created successfully!' }); } catch (error) { - console.error(error); res.status(500).json({ message: 'Error creating user' }); } }; @@ -133,7 +127,6 @@ exports.loginUser = async (req, res) => { const secretKey = process.env.SECRET_KEY; if (!secretKey) { - console.error('SECRET_KEY is not defined'); return res.status(500).json({ message: 'Internal server error' }); } @@ -145,7 +138,6 @@ exports.loginUser = async (req, res) => { res.json({ token, message: 'Login successful' }); } catch (error) { - console.error(error); res.status(500).json({ message: 'Internal server error' }); } };