From e9d3b9fcb07403900b19ebea6fb0ce727ed16b94 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 24 Sep 2024 19:07:02 +0530 Subject: [PATCH] fix: set error type explicitly any --- server/src/routes/auth.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/routes/auth.ts b/server/src/routes/auth.ts index 4740853a..e8d376e0 100644 --- a/server/src/routes/auth.ts +++ b/server/src/routes/auth.ts @@ -25,7 +25,7 @@ router.post('/register', async (req, res) => { httpOnly: true }) res.json(user) - } catch (error) { + } catch (error: any) { res.status(500).send(`Could not register user - ${error.message}`) } }) @@ -50,7 +50,7 @@ router.post('/login', async (req, res) => { httpOnly: true }) res.json(user) - } catch (error) { + } catch (error: any) { res.status(400).send(`Could not login user - ${error.message}`) } }) @@ -59,7 +59,7 @@ router.get('/logout', async (req, res) => { try { res.clearCookie('token') return res.json({ message: 'Logout successful' }) - } catch (error) { + } catch (error: any) { res.status(500).send(`Could not logout user - ${error.message}`) } }) @@ -73,7 +73,7 @@ router.get('/current-user', async (req: AuthenticatedRequest, res) => { attributes: { exclude: ['password'] }, }); return res.status(200).json({ ok: true }); - } catch (error) { + } catch (error: any) { return res.status(500).send(`Could not fetch current user : ${error.message}.`); } }); \ No newline at end of file