Skip to content

Commit

Permalink
Save currency choice after restart
Browse files Browse the repository at this point in the history
  • Loading branch information
n9lsjr committed Dec 13, 2023
1 parent 85a3a7a commit 5ab755c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/lib/stores/fiat.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ export async function getCoinPriceFromAPI() {

let ticker
const local = localStorage.getItem('fiat')

if (local === undefined) ticker = get(fiat).ticker.toLowerCase();
else ticker = local



/* Note: Coingecko has to support your coin for this to work */
let uri = `https://api.coingecko.com/api/v3/simple/price?ids=kryptokrona&vs_currencies=${ticker}`;
Expand All @@ -139,8 +137,7 @@ export async function getCoinPriceFromAPI() {

fiat.set({balance, ticker, currencies: currencies})

localStorage.setItem('fiat', ticker);

localStorage.setItem('fiat', ticker);
console.log('Updated coin price from API');
console.log('BALANCE:' + balance);

Expand Down
1 change: 1 addition & 0 deletions src/routes/wallet/settings/general/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
function pick(it) {
$fiat.ticker = it;
localStorage.setItem('fiat', it);
getCoinPriceFromAPI();
}
</script>
Expand Down

0 comments on commit 5ab755c

Please sign in to comment.