@abi-software/mapintegratedvuer 0.7.1-auth.4 → 0.7.1-auth.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/mapintegratedvuer",
3
- "version": "0.7.1-auth.4",
3
+ "version": "0.7.1-auth.6",
4
4
  "license": "Apache-2.0",
5
5
  "scripts": {
6
6
  "serve": "vite --host --force",
@@ -42,12 +42,12 @@
42
42
  "*.js"
43
43
  ],
44
44
  "dependencies": {
45
- "@abi-software/flatmapvuer": "^0.6.1-auth.5",
45
+ "@abi-software/flatmapvuer": "^0.6.1-auth.7",
46
46
  "@abi-software/map-side-bar": "^1.7.0-vue3.4",
47
47
  "@abi-software/plotvuer": "^0.4.0-vue-3-alpha.10",
48
48
  "@abi-software/scaffoldvuer": "^0.4.0-vue3.6",
49
49
  "@abi-software/simulationvuer": "^0.7.0-vue-3-alpha.5",
50
- "@abi-software/svg-sprite": "^0.4.0-vue3-beta.0",
50
+ "@abi-software/svg-sprite": "^0.4.0-vue3.3",
51
51
  "@cypress/vite-dev-server": "^5.0.7",
52
52
  "@element-plus/icons-vue": "^2.3.1",
53
53
  "@pinia/testing": "^0.1.3",
package/src/main.js CHANGED
@@ -6,7 +6,7 @@ import App from './App.vue'
6
6
  import { useMainStore } from './stores/index'
7
7
 
8
8
  const routes = [
9
- { path: '/'},
9
+ { path: '/' },
10
10
  ]
11
11
 
12
12
  const router = VueRouter.createRouter({
@@ -20,6 +20,13 @@ const app = createApp(App)
20
20
 
21
21
  app.use(pinia)
22
22
  app.use(router)
23
- app.mount('#app')
24
23
 
25
- useMainStore()
24
+ const mainStore = useMainStore()
25
+ const token = document.cookie
26
+ .split("; ")
27
+ .find((row) => row.startsWith("user-token"))
28
+ if (mainStore && token) {
29
+ mainStore.setUserToken(token.split("=")[1])
30
+ }
31
+
32
+ app.mount('#app')
@@ -1,5 +1,10 @@
1
1
  import { defineStore } from 'pinia'
2
2
 
3
+ /**
4
+ * Activate the store when run the application individually.
5
+ * If the store exist in parent application,
6
+ * instead of creating a new store it will access the parent main store.
7
+ */
3
8
  export const useMainStore = defineStore('main', {
4
9
  state: () => ({
5
10
  userProfile: {
@@ -11,4 +16,9 @@ export const useMainStore = defineStore('main', {
11
16
  return state.userProfile.token
12
17
  },
13
18
  },
19
+ actions: {
20
+ setUserToken(value) {
21
+ this.userProfile.token = value
22
+ },
23
+ }
14
24
  })