From d640d660d6f87067ab17216d8d6dd121abafbaba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=20Keskim=C3=A4ki?= Date: Fri, 24 Feb 2023 13:47:22 +0200 Subject: [PATCH] Check for user in faculties route --- src/server/routes/faculty.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/server/routes/faculty.ts b/src/server/routes/faculty.ts index 28233742..b36dd986 100644 --- a/src/server/routes/faculty.ts +++ b/src/server/routes/faculty.ts @@ -30,6 +30,8 @@ facultyRouter.get('/', async (req, res) => { facultyRouter.get('/user', async (req: RequestWithUser, res) => { const { id, iamGroups } = req.user + if (!id) return res.send([]) + const organisationData = await getUserOrganisations(id, iamGroups) const faculties = organisationData.map(({ code, name }) => ({ code, name }))