dburl geaendert
This commit is contained in:
@@ -38,13 +38,10 @@ router.post('/register', async (req, res) => {
|
||||
const token = jwt.sign({ id: user.id }, process.env.JWT_SECRET, { expiresIn: '24h' })
|
||||
res.json({ token })
|
||||
} catch (err) {
|
||||
console.log(err.message);
|
||||
// Wenn Prisma meldet, dass der Username schon existiert (Fehlercode P2002)
|
||||
if (err.code === 'P2002') {
|
||||
return res.status(409).json({ message: "Username bereits vergeben" });
|
||||
console.log(err.message)
|
||||
res.sendStatus(503)
|
||||
}
|
||||
res.status(500).json({ message: "Fehler bei der Registrierung" });
|
||||
}})
|
||||
})
|
||||
|
||||
router.post('/login', async (req, res) => {
|
||||
// we get their email, and we look up the password associated with that email in the database
|
||||
|
||||
Reference in New Issue
Block a user