handled a returned array as opposed to a returned object

This commit is contained in:
Paul Trowbridge 2022-04-22 23:35:48 -04:00
parent 3d9bc487ba
commit 0b5ee0bdf3
1 changed files with 6 additions and 2 deletions

View File

@ -39,8 +39,12 @@ Postgres.FirstRow = function(inSQL, args, inResponse) {
if (err === null) {
//need to test if the response is an object or an array
//inResponse.json(res.rows[0]);
//if (Array.isArray(res)) {}
inResponse.json(res[1].rows[0]);
if (Array.isArray(res)) {
inResponse.json(res[1].rows[0]);
}
else {
inResponse.json(res.rows[0]);
}
return;
}
console.log(err.stack);