From 9c5ce63ec9a4cb310bd23814f02bb16ae9bbc159 Mon Sep 17 00:00:00 2001 From: Dustin Do Date: Sun, 9 Jun 2024 02:04:10 +0700 Subject: [PATCH] fix(api): [Wallet] fix missing walletWithBalance await --- apps/api/v1/routes/wallets.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/api/v1/routes/wallets.ts b/apps/api/v1/routes/wallets.ts index d71f5105..a660b795 100644 --- a/apps/api/v1/routes/wallets.ts +++ b/apps/api/v1/routes/wallets.ts @@ -21,7 +21,9 @@ const router = new Hono() .get('/wallets', async (c) => { const user = getAuthUserStrict(c) - const wallets = (await findUserWallets({ user })).map(walletWithBalance) + const wallets = await Promise.all( + (await findUserWallets({ user })).map(walletWithBalance), + ) return c.json(wallets, 200) }) @@ -37,7 +39,7 @@ const router = new Hono() const wallet = await createWallet({ user, data }) - return c.json(walletWithBalance(wallet), 201) + return c.json(await walletWithBalance(wallet), 201) }) .put( @@ -62,7 +64,7 @@ const router = new Hono() const updatedWallet = await updateWallet({ walletId, data }) - return c.json(walletWithBalance(updatedWallet), 200) + return c.json(await walletWithBalance(updatedWallet), 200) }, )