mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +01:00
Update blue_modules/currency.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
a7550df576
commit
5570c124cd
1 changed files with 10 additions and 5 deletions
|
@ -62,11 +62,16 @@ async function updateExchangeRate(): Promise<void> {
|
|||
}
|
||||
} else {
|
||||
// Handle unexpected errors without alerting the user
|
||||
const rate = JSON.parse((await AsyncStorage.getItem(EXCHANGE_RATES_STORAGE_KEY)) || '{}');
|
||||
rate.LAST_UPDATED_ERROR = true;
|
||||
exchangeRates.LAST_UPDATED_ERROR = true;
|
||||
await AsyncStorage.setItem(EXCHANGE_RATES_STORAGE_KEY, JSON.stringify(rate));
|
||||
}
|
||||
try {
|
||||
const rate = JSON.parse((await AsyncStorage.getItem(EXCHANGE_RATES_STORAGE_KEY)) || '{}');
|
||||
rate.LAST_UPDATED_ERROR = true;
|
||||
exchangeRates.LAST_UPDATED_ERROR = true;
|
||||
await AsyncStorage.setItem(EXCHANGE_RATES_STORAGE_KEY, JSON.stringify(rate));
|
||||
} catch (parseError) {
|
||||
console.error('Failed to parse exchange rates from storage', parseError);
|
||||
exchangeRates.LAST_UPDATED_ERROR = true;
|
||||
await AsyncStorage.removeItem(EXCHANGE_RATES_STORAGE_KEY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue