@enfyra/sdk-nuxt 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -9,7 +9,7 @@ export function validateTokens(event) {
|
|
|
9
9
|
const accessToken = getCookie(event, ACCESS_TOKEN_KEY);
|
|
10
10
|
const refreshToken = getCookie(event, REFRESH_TOKEN_KEY);
|
|
11
11
|
const expTime = getCookie(event, EXP_TIME_KEY);
|
|
12
|
-
const isTokenExpired = expTime && Date.now() > parseInt(expTime)
|
|
12
|
+
const isTokenExpired = expTime && Date.now() > parseInt(expTime);
|
|
13
13
|
if (accessToken && !isTokenExpired) {
|
|
14
14
|
return { accessToken, needsRefresh: false };
|
|
15
15
|
} else if (refreshToken && (isTokenExpired || !accessToken)) {
|
package/package.json
CHANGED
|
@@ -17,7 +17,8 @@ export function validateTokens(event: H3Event): TokenValidationResult {
|
|
|
17
17
|
const expTime = getCookie(event, EXP_TIME_KEY);
|
|
18
18
|
|
|
19
19
|
// Check if access token is expired
|
|
20
|
-
|
|
20
|
+
// expTime is expected to be in milliseconds
|
|
21
|
+
const isTokenExpired = expTime && Date.now() > parseInt(expTime);
|
|
21
22
|
|
|
22
23
|
if (accessToken && !isTokenExpired) {
|
|
23
24
|
// Token is valid, use it
|