@jetlinks-web/core 2.1.8 → 2.2.1

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/index.ts CHANGED
@@ -1,3 +1,6 @@
1
1
  export * from './src/axios'
2
2
  export * from './src/fetch'
3
3
  export * from './src/websocket'
4
+ export * from './src/router'
5
+ export * from './src/stores'
6
+ export * from './src/locales'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/core",
3
- "version": "2.1.8",
3
+ "version": "2.2.1",
4
4
  "main": "index.ts",
5
5
  "module": "index.ts",
6
6
  "keywords": [
@@ -22,8 +22,8 @@
22
22
  "axios": "^1.7.4",
23
23
  "rxjs": "^7.8.1",
24
24
  "@jetlinks-web/constants": "^1.0.9",
25
- "@jetlinks-web/types": "^1.0.2",
26
- "@jetlinks-web/utils": "^1.2.8"
25
+ "@jetlinks-web/utils": "^1.2.8",
26
+ "@jetlinks-web/types": "^1.0.2"
27
27
  },
28
28
  "publishConfig": {
29
29
  "registry": "https://registry.npmjs.org/",
package/src/axios.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TOKEN_KEY, BASE_API, LOCAL_BASE_API } from '@jetlinks-web/constants'
1
+ import { TOKEN_KEY, BASE_API } from '@jetlinks-web/constants'
2
2
  import { getToken } from '@jetlinks-web/utils'
3
3
  import axios from 'axios'
4
4
  import type {
@@ -66,7 +66,7 @@ const controller = new AbortController();
66
66
  const handleRequest = (config: InternalAxiosRequestConfig) => {
67
67
  const token = getToken()
68
68
  const lang = localStorage.getItem(_options.langKey)
69
- const localBaseApi = localStorage.getItem(LOCAL_BASE_API)
69
+ const localBaseApi = localStorage.getItem('')
70
70
 
71
71
  if (lang) {
72
72
  config.headers[_options.langKey] = lang
package/src/locales.ts ADDED
@@ -0,0 +1,7 @@
1
+ let locales
2
+
3
+ const installLocales = (l) => {
4
+ locales = l
5
+ }
6
+
7
+ export { locales, installLocales }
package/src/router.ts ADDED
@@ -0,0 +1,7 @@
1
+ let router
2
+
3
+ const installRouter = (r) => {
4
+ router = r
5
+ }
6
+
7
+ export { router, installRouter }
package/src/stores.ts ADDED
@@ -0,0 +1,10 @@
1
+ let stores = {}
2
+
3
+ const installStores = (_s = {}) => {
4
+ stores = _s
5
+ }
6
+
7
+ export {
8
+ stores,
9
+ installStores
10
+ }
package/src/websocket.ts CHANGED
@@ -1,10 +1,7 @@
1
- import { wsClient } from '@/utils/websocket';
2
1
  import { webSocket, WebSocketSubject } from 'rxjs/webSocket';
3
2
  import { Observable, Subject, timer, Subscription, EMPTY } from 'rxjs';
4
3
  import { retry, catchError } from 'rxjs/operators';
5
4
  import { notification } from 'ant-design-vue';
6
- import app from '@micro-zoe/micro-app'
7
- import { log } from 'console';
8
5
 
9
6
  interface WebSocketMessage {
10
7
  type: string;
@@ -36,7 +33,7 @@ export class WebSocketClient {
36
33
  private wsClient: WebSocketClient | undefined
37
34
 
38
35
  constructor(options?: WS_Options) {
39
- this.options = options || {};
36
+ this.setOptions(options)
40
37
  this.setupConnectionMonitor();
41
38
  if (isApp) {
42
39
  (window as any).microApp.addGlobalDataListener((data) => {
@@ -45,6 +42,10 @@ export class WebSocketClient {
45
42
  }
46
43
  }
47
44
 
45
+ public setOptions(options: WS_Options) {
46
+ this.options = options || {}
47
+ }
48
+
48
49
  public initWebSocket(url: string) {
49
50
  this.url = url;
50
51
  }