diff options
| author | Pitu <[email protected]> | 2019-04-24 08:41:49 +0000 |
|---|---|---|
| committer | Pitu <[email protected]> | 2019-04-24 08:41:49 +0000 |
| commit | fec273b23b2d5792d0900151bb17a33ad3c8d9dc (patch) | |
| tree | 7f74a1fe0e19739fb5612b7b7e10e90ad7df718f /src/api/structures | |
| parent | Standarize database calls to support sqlite as well as mysql/postgres (diff) | |
| download | host.fuwn.me-fec273b23b2d5792d0900151bb17a33ad3c8d9dc.tar.xz host.fuwn.me-fec273b23b2d5792d0900151bb17a33ad3c8d9dc.zip | |
Fix when response is not an object
Diffstat (limited to 'src/api/structures')
| -rw-r--r-- | src/api/structures/Route.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/api/structures/Route.js b/src/api/structures/Route.js index 17f210e..cb2878b 100644 --- a/src/api/structures/Route.js +++ b/src/api/structures/Route.js @@ -31,11 +31,9 @@ const db = require('knex')({ return row; }; - if (Array.isArray(result)) { - return result.map(row => processResponse(row)); - } - - return processResponse(result); + if (Array.isArray(result)) return result.map(row => processResponse(row)); + if (typeof result === 'object') return processResponse(result); + return result; }, useNullAsDefault: process.env.DB_CLIENT === 'sqlite3' ? true : false }); |