()
| 185 | } |
| 186 | |
| 187 | export async function refreshCryptoRatesForced(): Promise<CurrencyRatesPayload> { |
| 188 | const cryptoRates = await fetchCryptoRates() |
| 189 | const cached = store.currencyRates.get('cache') |
| 190 | |
| 191 | if (!cached) { |
| 192 | return createPayload(cryptoRates) |
| 193 | } |
| 194 | |
| 195 | const payload = createPayload({ ...cached.rates, ...cryptoRates }) |
| 196 | store.currencyRates.set('cache', { |
| 197 | rates: payload.rates, |
| 198 | fetchedAt: payload.fetchedAt, |
| 199 | }) |
| 200 | |
| 201 | return payload |
| 202 | } |
no test coverage detected