fixed error with duplicate stringify operation in api routes
Co-authored-by: Spacelord <Spacelord09@users.noreply.github.com>
This commit is contained in:
@ -17,7 +17,7 @@ function get(req: Request, res: Response) {
|
||||
})
|
||||
.then((item) => {
|
||||
if (item) {
|
||||
res.status(200).json(JSON.stringify(item));
|
||||
res.status(200).json(item);
|
||||
} else {
|
||||
res.status(410).json({ errorcode: 'NOT_EXISTING', error: 'Category does not exist' });
|
||||
}
|
||||
|
@ -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' });
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ function get(req: Request, res: Response) {
|
||||
}
|
||||
})
|
||||
.then((items) => {
|
||||
res.status(200).json(JSON.stringify(items));
|
||||
res.status(200).json(items);
|
||||
})
|
||||
.catch((err) => {
|
||||
log.db.error(err);
|
||||
|
@ -21,7 +21,7 @@ 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: 'storageLocation does not exist' });
|
||||
}
|
||||
@ -40,7 +40,7 @@ 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: 'storageLocation does not exist' });
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ 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: 'storageUnit does not exist' });
|
||||
}
|
||||
@ -43,7 +43,7 @@ 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: 'storageUnit does not exist' });
|
||||
}
|
||||
|
Reference in New Issue
Block a user