From 4357d80ce380e006f48f6895d44f423e02b59d37 Mon Sep 17 00:00:00 2001 From: Ali Date: Fri, 20 Feb 2026 19:26:42 +0900 Subject: [PATCH] dburl geaendert --- public/index.html | 1 - src/routes/authRoutes.js | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/public/index.html b/public/index.html index d7bc511..23034da 100644 --- a/public/index.html +++ b/public/index.html @@ -48,7 +48,6 @@ const username = document.getElementById('emailInput').value; const password = document.getElementById('passwordInput').value; const errorDisplay = document.getElementById('error'); - const data = await response.json().catch(() => ({ message: "Server antwortet nicht lesbar" })); // Entscheide, an welche Tür (URL) wir klopfen const endpoint = isRegisterMode ? '/auth/register' : '/auth/login'; diff --git a/src/routes/authRoutes.js b/src/routes/authRoutes.js index d1c7773..670e2e3 100644 --- a/src/routes/authRoutes.js +++ b/src/routes/authRoutes.js @@ -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