From 50b0cdb70baa00b053f8247b3bf43faf3a0499d8 Mon Sep 17 00:00:00 2001 From: Mats Andreassen Date: Wed, 27 Jan 2021 23:36:54 +0100 Subject: [PATCH] =?UTF-8?q?Om=20l=C3=A6reren=20ikke=20finnes,=20ikke=20ret?= =?UTF-8?q?urner=20YFF-data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YFF/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/YFF/index.js b/YFF/index.js index f0bebc9..aa21020 100644 --- a/YFF/index.js +++ b/YFF/index.js @@ -34,6 +34,11 @@ const handleYFF = async (context, req) => { const isMe = student === user if (!isMe) { const students = await getMyStudents(user) + if (students === false) { + logger('info', ['handle-yff', 'method', method, 'student', student, 'user', user, 'teacher not found']) + return getResponse([]) + } + // If an ID was specified, verify that the teacher has access to this student before proceeding if (student && students.filter(s => s.userName === student).length === 0) { throw new HTTPError(403, 'You don\'t have access to this student!', { student })