mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-17 12:07:09 +00:00
Adds fallback to USD as currency rate selected in case that the data stored is not defined
This commit is contained in:
parent
6858a8d6d6
commit
1a901126df
@ -23,9 +23,16 @@ export const fetchCurrencyValues = (safeAddress: string) => async (dispatch) =>
|
||||
const safeAddr = kv[0]
|
||||
const value = kv[1]
|
||||
|
||||
const { currencyRate, selectedCurrency }: CurrencyRateValue = value
|
||||
let { currencyRate, selectedCurrency }: CurrencyRateValue = value
|
||||
|
||||
// Fallback for users that got an undefined saved on localStorage
|
||||
if (!selectedCurrency || selectedCurrency === AVAILABLE_CURRENCIES.USD) {
|
||||
currencyRate = 1
|
||||
selectedCurrency = AVAILABLE_CURRENCIES.USD
|
||||
}
|
||||
|
||||
batch(() => {
|
||||
dispatch(setSelectedCurrency(safeAddr, selectedCurrency || AVAILABLE_CURRENCIES.USD))
|
||||
dispatch(setSelectedCurrency(safeAddr, selectedCurrency))
|
||||
dispatch(setCurrencyRate(safeAddr, currencyRate))
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user