diff --git a/index.html b/index.html index c57bfea..e9935b8 100644 --- a/index.html +++ b/index.html @@ -968,7 +968,7 @@ -
+
@@ -2023,7 +2023,14 @@ getTransactionsHistory({ limit: 5 }).then(transactions => { renderElem(getRef('recent_transactions'), html`${transactions.map(transaction => render.transactionCard(transaction))}`) }).catch(e => { - console.log(e) + console.error(e) + getRef('recent_transactions').parentNode.querySelector('a').classList.add('hidden') + renderElem(getRef('recent_transactions'), html` +
+

Oops!

+

Looks like we couldn't fetch your transactions at this time. Please try again later.

+
+ `) }) render.savedIds() } @@ -3519,7 +3526,7 @@ icon = svg``; } else if (type === 'self') { transactionReceiver = `Sent to self`; - icon = svg``; + icon = svg``; } } else { transactionReceiver = (type === 'out' ? `Sent to ${receiver}` : `Received from ${sender}`); @@ -3555,7 +3562,10 @@ } else { getRef('payments_history').textContent = 'No transactions found'; } - }).catch(error => console.error(error)) + }).catch(error => { + getRef('payments_history').textContent = 'Unable to fetch transactions'; + console.error(error) + }) }, async savedIds() { let target = 'saved_ids_list'; @@ -3719,23 +3729,17 @@ return; } btcOperator.getAddressData(floGlobals.myBtcID).then(({ txs }) => { - console.log(txs) - let allTransactions = [] let propToCheck = false - if (type === 'out') + if (type === 'sent') propToCheck = 'out'; - else if (type === 'in') + else if (type === 'received') propToCheck = 'in'; - else if (type === 'self') - propToCheck = 'self'; - for (let i = 0; i < txs.length; i++) { - const tx = txs[i]; + let allTransactions = txs.filter(tx => { tx.asset = 'btc'; if (propToCheck) - if (tx.type !== propToCheck) - continue; - allTransactions.push(tx) - } + return (tx.type === propToCheck) + return true; + }) resolve(allTransactions) }).catch(error => reject(error)) })