fixed error with duplicate stringify operation in api routes

Co-authored-by: Spacelord <Spacelord09@users.noreply.github.com>
This commit is contained in:
2023-07-09 18:07:28 +02:00
parent 58a2d2ad19
commit 5524f14e1a
11 changed files with 15 additions and 23 deletions

View File

@ -43,7 +43,7 @@ async function get(req: Request, res: Response) {
})
.then((items) => {
if (items) {
res.status(200).json(JSON.stringify(items));
res.status(200).json(items);
} else {
res.status(410).json({ errorcode: 'NOT_EXISTING', error: 'Item does not exist' });
}
@ -117,7 +117,7 @@ async function get(req: Request, res: Response) {
})
.then((items) => {
if (items) {
res.status(200).json(JSON.stringify({ total: itemCountFiltered, totalNotFiltered: itemCountNotFiltered, items: items }));
res.status(200).json({ total: itemCountFiltered, totalNotFiltered: itemCountNotFiltered, items: items });
} else {
res.status(410).json({ errorcode: 'NOT_EXISTING', error: 'Item does not exist' });
}