mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2026-02-23 15:14:19 +01:00
Set price on startup
This commit is contained in:
committed by
Paul Miller
parent
e9fa349a1d
commit
b156412521
@@ -179,14 +179,28 @@ export const Provider: ParentComponent = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
// Get balance optimistically
|
||||
// Get balance + price optimistically
|
||||
const balance = await mutinyWallet.get_balance();
|
||||
let price;
|
||||
try {
|
||||
if (state.fiat.value === "BTC") {
|
||||
price = 1;
|
||||
} else {
|
||||
price = await mutinyWallet.get_bitcoin_price(
|
||||
state.fiat.value.toLowerCase() || "usd"
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
price = 0;
|
||||
}
|
||||
|
||||
setState({
|
||||
mutiny_wallet: mutinyWallet,
|
||||
wallet_loading: false,
|
||||
subscription_timestamp: subscription_timestamp,
|
||||
load_stage: "done",
|
||||
price: price || 0,
|
||||
balance
|
||||
});
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user