aboutsummaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2015-11-24 10:07:57 -0800
committerAdam Soltys <[email protected]>2015-11-27 22:02:48 -0800
commit9d4926c942928333ce9436649fe47abd3399003a (patch)
tree947c1469316c53627b681ebcee62b44c0bbb5568 /public
parent7db9ced7b02fac057c97460069ba800b6db2e391 (diff)
downloadcoinos-server-9d4926c942928333ce9436649fe47abd3399003a.tar.gz
coinos-server-9d4926c942928333ce9436649fe47abd3399003a.zip
Error handling
Diffstat (limited to 'public')
-rw-r--r--public/js/wallet.coffee5
1 files changed, 4 insertions, 1 deletions
diff --git a/public/js/wallet.coffee b/public/js/wallet.coffee
index dda576e7..aec62911 100644
--- a/public/js/wallet.coffee
+++ b/public/js/wallet.coffee
@@ -145,10 +145,13 @@ getAddresses = ->
calculateBalance = ->
balances = JSON.parse(localStorage.getItem(g.user.username)).balances
- balance = balances.reduce (t,s) -> t + s
+
+ balance = balances.length ? balances.reduce (t,s) -> t + s : 0
+
g.balance = (balance * multiplier() / 100000000).toFixed(precision())
fiat = (g.balance * g.exchange / multiplier()).toFixed(2)
$('#balance').html(g.balance)
+ $('#balance').parent().fadeIn()
$('#fiat').html("#{fiat} #{g.user.currency}")
$('#amount').val(g.balance)