@elrondnetwork/core-components
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -177,5 +177,13 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var oneMinTreshold = 60; | ||
return currentUnixTimestamp + oneMinTreshold < exp; | ||
var valid = currentUnixTimestamp + oneMinTreshold < exp; | ||
var oneHourOld = currentUnixTimestamp - exp > 60 * 60; | ||
return { | ||
valid: valid, | ||
oneHourOld: oneHourOld | ||
}; | ||
} catch (_unused) { | ||
return false; | ||
return { | ||
valid: false, | ||
oneHourOld: true | ||
}; | ||
} | ||
@@ -195,3 +203,11 @@ }; | ||
if (token) { | ||
if (token.accessToken && isValid(token.accessToken)) { | ||
var _isValid = isValid(token.accessToken), | ||
valid = _isValid.valid, | ||
oneHourOld = _isValid.oneHourOld; | ||
if (oneHourOld) { | ||
reject("Token too old"); | ||
} | ||
if (token.accessToken && valid) { | ||
resolve(token); | ||
@@ -198,0 +214,0 @@ } else { |
@@ -175,5 +175,13 @@ import axios from 'axios'; | ||
var oneMinTreshold = 60; | ||
return currentUnixTimestamp + oneMinTreshold < exp; | ||
var valid = currentUnixTimestamp + oneMinTreshold < exp; | ||
var oneHourOld = currentUnixTimestamp - exp > 60 * 60; | ||
return { | ||
valid: valid, | ||
oneHourOld: oneHourOld | ||
}; | ||
} catch (_unused) { | ||
return false; | ||
return { | ||
valid: false, | ||
oneHourOld: true | ||
}; | ||
} | ||
@@ -193,3 +201,11 @@ }; | ||
if (token) { | ||
if (token.accessToken && isValid(token.accessToken)) { | ||
var _isValid = isValid(token.accessToken), | ||
valid = _isValid.valid, | ||
oneHourOld = _isValid.oneHourOld; | ||
if (oneHourOld) { | ||
reject("Token too old"); | ||
} | ||
if (token.accessToken && valid) { | ||
resolve(token); | ||
@@ -196,0 +212,0 @@ } else { |
{ | ||
"name": "@elrondnetwork/core-components", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "Elrond Dapp Core Components", | ||
@@ -5,0 +5,0 @@ "author": "ElrondNetwork", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55998
697