From ff18417db6c1190c3799b439f3bf3dd05c29f5df Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 8 Dec 2024 00:05:58 -0800 Subject: check account --- routes/users.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'routes') diff --git a/routes/users.ts b/routes/users.ts index 9588727f..6efe61e3 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -638,7 +638,7 @@ export default { async account(req, res) { const { id } = req.params; const account = await g(`account:${id}`); - account.balance = await g(`balance:${id}`); + if (account) account.balance = await g(`balance:${id}`); res.send(account); }, @@ -649,11 +649,10 @@ export default { const accounts = []; for (const id of await db.lRange(`${user.id}:accounts`, 0, -1)) { const account = await g(`account:${id}`); - account.balance = await g(`balance:${id}`); - - // if (account.seed) reconcile(account); - - accounts.push(account); + if (account) { + account.balance = await g(`balance:${id}`); + accounts.push(account); + } } res.send(accounts.reverse()); -- cgit v1.2.3