Fix 500 on singleton retrieval

Fixes #418
This commit is contained in:
rijkvanzanten
2020-09-24 14:10:20 -04:00
parent e7489abfa6
commit 2af75e3cfb
7 changed files with 25 additions and 13 deletions

View File

@@ -113,7 +113,7 @@ router.post(
try {
const record = await service.readByKey(keys as any, req.sanitizedQuery);
res.locals.payload = {
data: res.locals.savedFiles.length === 1 ? record[0] : record || null,
data: res.locals.savedFiles.length === 1 ? record![0] : record || null,
};
} catch (error) {
if (error instanceof ForbiddenException) {