@nitra/vite-boot 2.1.3 → 2.1.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/apollo.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitra/vite-boot",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Vite boot",
5
5
  "type": "module",
6
6
  "exports": {
package/src/apollo.js CHANGED
@@ -10,14 +10,15 @@ const consola = createLogger(import.meta.url)
10
10
 
11
11
  const token = localStorage.getItem('token')
12
12
 
13
- consola.debug('token: ', token)
14
- console.log('token: ', token)
13
+ consola.debug('token a: ', token)
14
+ console.log('token d: ', token)
15
15
  if (!token) {
16
16
  window.location.replace('/logout')
17
17
  }
18
18
 
19
19
  // Перевіряємо чи не старий токен знаходиться в localStorage
20
20
  const tokenDecoded = jwtDecode(token)
21
+
21
22
  if (tokenDecoded.exp < Math.floor(Date.now() / 1000)) {
22
23
  refreshToken()
23
24
  }