diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-07-06 19:19:33 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-07-08 13:23:30 +0200 |
| commit | 8452dc8559837253b253df7f47a075f156845e66 (patch) | |
| tree | ee319953943eba896f10d0078ba6686ccb646bd6 /gui/src/shared | |
| parent | 01b8b634786777369c22940f2790477bdece36b8 (diff) | |
| download | mullvadvpn-8452dc8559837253b253df7f47a075f156845e66.tar.xz mullvadvpn-8452dc8559837253b253df7f47a075f156845e66.zip | |
Prevent account data fetch on show unless within 4 days of expiry
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/account-expiry.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gui/src/shared/account-expiry.ts b/gui/src/shared/account-expiry.ts index 7ca382efb2..81c45fec07 100644 --- a/gui/src/shared/account-expiry.ts +++ b/gui/src/shared/account-expiry.ts @@ -5,10 +5,10 @@ export function hasExpired(expiry: DateType): boolean { return new Date(expiry).getTime() < Date.now(); } -export function closeToExpiry(expiry: DateType): boolean { +export function closeToExpiry(expiry: DateType, days = 3): boolean { return ( !hasExpired(expiry) && - new Date(expiry) <= dateByAddingComponent(new Date(), DateComponent.day, 3) + new Date(expiry) <= dateByAddingComponent(new Date(), DateComponent.day, days) ); } |
