Profile saving works

This commit is contained in:
AG
2025-11-20 22:56:38 +02:00
parent 17ae81d5d9
commit 84417847fd
6 changed files with 39 additions and 11 deletions

View File

@@ -105,6 +105,13 @@ router.patch('/profile', async (req, res) => {
if (!token) return res.status(401).json({ error: 'Unauthorized' });
const { userId, profile } = req.body;
console.log('DEBUG: Updating profile for', userId, profile);
// Convert birthDate from timestamp to Date object if needed
if (profile.birthDate) {
// Handle both number (timestamp) and string (ISO)
profile.birthDate = new Date(profile.birthDate);
}
// Verify token
const decoded = jwt.verify(token, JWT_SECRET) as any;