Excessive logging deprecated
This commit is contained in:
@@ -81,7 +81,7 @@ const Profile: React.FC<ProfileProps> = ({ user, onLogout, lang, onLanguageChang
|
|||||||
|
|
||||||
const refreshExercises = async () => {
|
const refreshExercises = async () => {
|
||||||
const exercises = await getExercises(user.id);
|
const exercises = await getExercises(user.id);
|
||||||
console.log('Refreshed exercises:', exercises);
|
|
||||||
setExercises(exercises);
|
setExercises(exercises);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -172,9 +172,9 @@ const Profile: React.FC<ProfileProps> = ({ user, onLogout, lang, onLanguageChang
|
|||||||
// Exercise Management Handlers
|
// Exercise Management Handlers
|
||||||
const handleArchiveExercise = async (ex: ExerciseDef, archive: boolean) => {
|
const handleArchiveExercise = async (ex: ExerciseDef, archive: boolean) => {
|
||||||
const updated = { ...ex, isArchived: archive };
|
const updated = { ...ex, isArchived: archive };
|
||||||
console.log('Archiving exercise:', updated);
|
|
||||||
await saveExercise(user.id, updated);
|
await saveExercise(user.id, updated);
|
||||||
console.log('Archive complete, refreshing...');
|
|
||||||
await refreshExercises();
|
await refreshExercises();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ router.post('/login', async (req, res) => {
|
|||||||
|
|
||||||
// Change Password
|
// Change Password
|
||||||
router.post('/change-password', async (req, res) => {
|
router.post('/change-password', async (req, res) => {
|
||||||
console.log('DEBUG: change-password route hit');
|
|
||||||
try {
|
try {
|
||||||
const token = req.headers.authorization?.split(' ')[1];
|
const token = req.headers.authorization?.split(' ')[1];
|
||||||
if (!token) return res.status(401).json({ error: 'Unauthorized' });
|
if (!token) return res.status(401).json({ error: 'Unauthorized' });
|
||||||
@@ -105,7 +105,7 @@ router.patch('/profile', async (req, res) => {
|
|||||||
if (!token) return res.status(401).json({ error: 'Unauthorized' });
|
if (!token) return res.status(401).json({ error: 'Unauthorized' });
|
||||||
|
|
||||||
const { userId, profile } = req.body;
|
const { userId, profile } = req.body;
|
||||||
console.log('DEBUG: Updating profile for', userId, profile);
|
|
||||||
|
|
||||||
// Convert birthDate from timestamp to Date object if needed
|
// Convert birthDate from timestamp to Date object if needed
|
||||||
if (profile.birthDate) {
|
if (profile.birthDate) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ router.get('/', async (req: any, res) => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log('GET /exercises - Returning:', exercises.map(e => ({ id: e.id, name: e.name, isArchived: e.isArchived })));
|
|
||||||
res.json(exercises);
|
res.json(exercises);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
res.status(500).json({ error: 'Server error' });
|
res.status(500).json({ error: 'Server error' });
|
||||||
@@ -48,7 +48,7 @@ router.post('/', async (req: any, res) => {
|
|||||||
const userId = req.user.userId;
|
const userId = req.user.userId;
|
||||||
const { id, name, type, bodyWeightPercentage, isArchived } = req.body;
|
const { id, name, type, bodyWeightPercentage, isArchived } = req.body;
|
||||||
|
|
||||||
console.log('POST /exercises - Received:', { id, name, type, bodyWeightPercentage, isArchived });
|
|
||||||
|
|
||||||
// If id exists and belongs to user, update. Else create.
|
// If id exists and belongs to user, update. Else create.
|
||||||
// Note: We can't update system exercises directly. If user edits a system exercise,
|
// Note: We can't update system exercises directly. If user edits a system exercise,
|
||||||
@@ -59,12 +59,12 @@ router.post('/', async (req: any, res) => {
|
|||||||
// Check if it exists and belongs to user
|
// Check if it exists and belongs to user
|
||||||
const existing = await prisma.exercise.findUnique({ where: { id } });
|
const existing = await prisma.exercise.findUnique({ where: { id } });
|
||||||
if (existing && existing.userId === userId) {
|
if (existing && existing.userId === userId) {
|
||||||
console.log('Updating existing exercise with:', { name, type, bodyWeightPercentage, isArchived });
|
|
||||||
const updated = await prisma.exercise.update({
|
const updated = await prisma.exercise.update({
|
||||||
where: { id },
|
where: { id },
|
||||||
data: { name, type, bodyWeightPercentage, isArchived }
|
data: { name, type, bodyWeightPercentage, isArchived }
|
||||||
});
|
});
|
||||||
console.log('Updated exercise:', updated);
|
|
||||||
return res.json(updated);
|
return res.json(updated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user