directus-sdk-javascript
Advanced tools
Comparing version 3.0.0-16 to 3.0.0-17
{ | ||
"name": "directus-sdk-javascript", | ||
"version": "3.0.0-16", | ||
"version": "3.0.0-17", | ||
"description": "WIP - Directus SDK for JavaScript (Node and Browser)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,3 +14,10 @@ const axios = require('axios'); | ||
this._headers = {}; | ||
this._refreshInterval = null; | ||
this._refreshInterval = setInterval(() => { | ||
if (!this.accessToken || !this.url) return; | ||
const timeDiff = this.payload.exp.getTime() - Date.now(); | ||
if (timeDiff < 30000) { | ||
this.refresh(this.accessToken); | ||
} | ||
}, 10000); | ||
} | ||
@@ -52,6 +59,6 @@ | ||
if (accessTokenExpired) return false; | ||
if (accessTokenExpired === false) return true; | ||
} | ||
return true; | ||
return false; | ||
} | ||
@@ -104,10 +111,3 @@ | ||
this.refreshInterval = setInterval(() => { | ||
const timeDiff = this.payload.exp.getTime() - Date.now(); | ||
if (timeDiff < 30000) { | ||
this.refresh(this.accessToken); | ||
} | ||
}, 10000) | ||
this.emit('login:success'); | ||
@@ -129,4 +129,2 @@ resolve(); | ||
this.database = '_'; | ||
clearInterval(this._refreshInterval); | ||
} | ||
@@ -148,3 +146,3 @@ | ||
this.logout(); | ||
}) | ||
}); | ||
} | ||
@@ -151,0 +149,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
41544
159