Skip to content

Commit

Permalink
Fix the sign of the tokenExpireIn correction
Browse files Browse the repository at this point in the history
Make sure that even in a minute, the token is not to expire.
  • Loading branch information
kbulygin authored Dec 14, 2022
1 parent 8a01592 commit 4a4b829
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class NalogAPI {
* @returns {Promise(string)}
*/
async getToken () {
if (this.token && this.tokenExpireIn && new Date().getTime() - 60 * 1000 < new Date(this.tokenExpireIn).getTime()) {
if (this.token && this.tokenExpireIn && new Date().getTime() + 60 * 1000 < new Date(this.tokenExpireIn).getTime()) {
return this.token
}

Expand Down

0 comments on commit 4a4b829

Please sign in to comment.