maybeFetchNewCredentials: Fetch if we don't have credentials for today
This commit is contained in:
@@ -201,8 +201,11 @@ export function getDatesForRequest(
|
|||||||
const today = toDayMillis(Date.now());
|
const today = toDayMillis(Date.now());
|
||||||
const sixDaysOut = today + 6 * durations.DAY;
|
const sixDaysOut = today + 6 * durations.DAY;
|
||||||
|
|
||||||
|
const haveToday = data?.some(
|
||||||
|
({ redemptionTime }) => redemptionTime === today
|
||||||
|
);
|
||||||
const lastCredential = last(data);
|
const lastCredential = last(data);
|
||||||
if (!lastCredential || lastCredential.redemptionTime < today) {
|
if (!haveToday || !lastCredential || lastCredential.redemptionTime < today) {
|
||||||
return {
|
return {
|
||||||
startDayInMs: today,
|
startDayInMs: today,
|
||||||
endDayInMs: sixDaysOut,
|
endDayInMs: sixDaysOut,
|
||||||
|
Reference in New Issue
Block a user