maybeFetchNewCredentials: Fetch if we don't have credentials for today

This commit is contained in:
Scott Nonnenberg
2023-02-02 13:35:27 -08:00
committed by GitHub
parent ab7ab91429
commit 5701848aa5

View File

@@ -201,8 +201,11 @@ export function getDatesForRequest(
const today = toDayMillis(Date.now());
const sixDaysOut = today + 6 * durations.DAY;
const haveToday = data?.some(
({ redemptionTime }) => redemptionTime === today
);
const lastCredential = last(data);
if (!lastCredential || lastCredential.redemptionTime < today) {
if (!haveToday || !lastCredential || lastCredential.redemptionTime < today) {
return {
startDayInMs: today,
endDayInMs: sixDaysOut,