@nitra/vite-boot 1.0.8 → 1.0.9
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/package.json +7 -1
- package/src/apollo.js +2 -5
- package/src/i18n.js +9 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitra/vite-boot",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Vite boot",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -21,7 +21,13 @@
|
|
|
21
21
|
"author": "vitaliytv <vitaliytv@nitralabs.com>",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"prettier": "@nitra/prettier-config",
|
|
24
|
+
"eslintConfig": {
|
|
25
|
+
"extends": [
|
|
26
|
+
"@nitra/eslint-config/vue"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
24
29
|
"devDependencies": {
|
|
30
|
+
"@nitra/eslint-config": "^1.0.9",
|
|
25
31
|
"@nitra/prettier-config": "^1.0.0"
|
|
26
32
|
},
|
|
27
33
|
"files": [
|
package/src/apollo.js
CHANGED
|
@@ -5,13 +5,9 @@ import { onError } from '@apollo/client/link/error'
|
|
|
5
5
|
import { print } from 'graphql'
|
|
6
6
|
import { createClient } from 'graphql-ws'
|
|
7
7
|
import { createLogger } from '@nitra/consola/browser'
|
|
8
|
-
import { isDev, isProd } from '@nitra/isenv'
|
|
9
8
|
|
|
10
9
|
const consola = createLogger(import.meta.url)
|
|
11
10
|
|
|
12
|
-
console.log('isDev', isDev)
|
|
13
|
-
console.log('isProd', isProd)
|
|
14
|
-
|
|
15
11
|
class WebSocketLink extends ApolloLink {
|
|
16
12
|
constructor(options) {
|
|
17
13
|
super()
|
|
@@ -99,7 +95,8 @@ const errorLink = onError(({ graphQLErrors, networkError, operation, forward })
|
|
|
99
95
|
// instead of the onError link. This just logs the error.
|
|
100
96
|
if (networkError) {
|
|
101
97
|
if (networkError?.message.match('JWTExpired')) {
|
|
102
|
-
|
|
98
|
+
console.log(`[Network err]: ${networkError}`)
|
|
99
|
+
// localStorage.removeItem('token')
|
|
103
100
|
window.location.replace('/login')
|
|
104
101
|
} else {
|
|
105
102
|
console.log(`[Network error]: ${networkError}`)
|
package/src/i18n.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createI18n } from 'petite-vue-i18n'
|
|
2
|
-
import {
|
|
2
|
+
import { persistStore } from 'src/stores/persist.js'
|
|
3
3
|
|
|
4
4
|
const consola = createLogger(import.meta.url)
|
|
5
5
|
|
|
@@ -29,4 +29,12 @@ export const mt = uk => {
|
|
|
29
29
|
return ukP
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
export const updGlobalLocale = lang => {
|
|
33
|
+
const persist = persistStore()
|
|
34
|
+
if (lang) {
|
|
35
|
+
persist.locale = lang
|
|
36
|
+
}
|
|
37
|
+
i18n.global.locale.value = persist.locale
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
consola.debug('End i18n boot')
|