Handled API not working in UI

This commit is contained in:
sairaj mote 2023-02-18 00:36:58 +05:30
parent 9c99228119
commit e92c813a23

View File

@ -712,16 +712,15 @@
} }
}); });
getExchangeRate() getExchangeRate()
.then(() => { .catch(e => {
console.error(e)
getRef('currency_selector').classList.add('hidden')
}).finally(() => {
routeTo(window.location.hash) routeTo(window.location.hash)
setTimeout(() => { setTimeout(() => {
getRef('loading_page').animate([ getRef('loading_page').animate([
{ { transform: 'translateY(0)', },
transform: 'translateY(0)', { transform: 'translateY(-100%)', }
},
{
transform: 'translateY(-100%)',
}
], { ], {
duration: 300, duration: 300,
fill: 'forwards', fill: 'forwards',
@ -731,10 +730,6 @@
} }
}, 500); }, 500);
}) })
.catch(e => {
console.error(e)
notify('Error fetching exchange rate', 'error')
})
selectedCurrency = localStorage.getItem('btc-wallet-currency') || 'btc' selectedCurrency = localStorage.getItem('btc-wallet-currency') || 'btc'
getRef('currency_selector').value = selectedCurrency getRef('currency_selector').value = selectedCurrency
getRef('add_sender').click(); getRef('add_sender').click();
@ -1311,8 +1306,8 @@
}) })
globalExchangeRate.btc = 1 globalExchangeRate.btc = 1
resolve(globalExchangeRate) resolve(globalExchangeRate)
}).catch(err => console.log(err)) }).catch(err => reject(err))
}).catch(err => console.log(err)) }).catch(err => reject(err))
}) })
} }
function getConvertedAmount(amount) { function getConvertedAmount(amount) {
@ -1535,6 +1530,9 @@
<p style="opacity: 0.8;">*Exact fee will be calculated after you fill all the required fields</p> <p style="opacity: 0.8;">*Exact fee will be calculated after you fill all the required fields</p>
</div> </div>
`) `)
}).catch(e => {
getRef('fees_selector').children[1].click();
getRef('fees_selector').classList.add('hidden')
}) })
} }
getRef('fees_section').classList.remove('hidden') getRef('fees_section').classList.remove('hidden')