From 06ea7ba3f1b9a99fdabeb287893d01560d79b422 Mon Sep 17 00:00:00 2001 From: Kayo Oliveira Date: Fri, 16 Sep 2022 17:21:43 -0300 Subject: [PATCH] fix(Fixing bug when balance comes 0 from database, the function not set in store): :sparkles: --- src/layouts/DefaultLayout/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/layouts/DefaultLayout/index.tsx b/src/layouts/DefaultLayout/index.tsx index 7b82819..7646305 100644 --- a/src/layouts/DefaultLayout/index.tsx +++ b/src/layouts/DefaultLayout/index.tsx @@ -18,8 +18,9 @@ export function DefaultLayout() { onValue(walletRef, async snapshot => { if (snapshot.exists()) { const data = snapshot.val() - if (data.currentBalance && isAuth) { - await setCurrentBalance(data.currentBalance) + if (data && isAuth) { + console.log(data) + setCurrentBalance(data.currentBalance) return } return