Skip to content

Commit 6ab6a97

Browse files
authored
examples/hosted-fungible: update balance even if zero (#47)
1 parent 8085048 commit 6ab6a97

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

examples/hosted-fungible/index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,7 @@ <h2>Chain history for <code id="chain-id" class="hex">requesting a new microchai
159159
const response = JSON.parse(await application.query(gql(`query { tickerSymbol, accounts { entries { key value } } }`)));
160160
console.debug('application response:', response);
161161
document.querySelector('#ticker-symbol').textContent = response.data.tickerSymbol;
162-
163-
if (response?.data?.accounts?.entries?.[0])
164-
document.querySelector('#balance').textContent = (+response.data.accounts.entries[0].value).toFixed(2);
162+
document.querySelector('#balance').textContent = (+(response?.data?.accounts?.entries?.[0] || 0)).toFixed(2);
165163
}
166164

167165
async function transfer(application, donor, amount, recipient) {

0 commit comments

Comments
 (0)