adminforth 1.2.8 → 1.2.10

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.
@@ -190,6 +190,7 @@ class ExpressServer {
190
190
  status: 200,
191
191
  message: undefined,
192
192
  setHeader(name, value) {
193
+ process.env.HEAVY_DEBUG && console.log(' 🪲Setting header', name, value);
193
194
  this.headers.push([name, value]);
194
195
  },
195
196
  setStatus(code, message) {
@@ -294,8 +294,8 @@ watch (()=>coreStore.menu, () => {
294
294
  watch([loggedIn, routerIsReady, loginRedirectCheckIsReady], ([l,r,lr]) => {
295
295
  if (l && r && lr) {
296
296
  setTimeout(() => {
297
- initFlowbite();
298
- });
297
+ initFlowbite();
298
+ });
299
299
  }
300
300
  })
301
301
 
@@ -1,6 +1,12 @@
1
- import {ref} from 'vue';
2
- import {defineStore} from 'pinia';
1
+ import { ref } from 'vue';
2
+ import { defineStore } from 'pinia';
3
3
  import { callAdminForthApi } from '@/utils';
4
+ import { initFlowbite } from 'flowbite'
5
+ import { useRouter } from 'vue-router';
6
+ import { useCoreStore } from './core';
7
+ import router from '@/router';
8
+
9
+
4
10
 
5
11
  export const useUserStore = defineStore('user', () => {
6
12
  const isAuthorized = ref(false);
@@ -15,6 +21,18 @@ export const useUserStore = defineStore('user', () => {
15
21
  localStorage.setItem('isAuthorized', 'false');
16
22
  }
17
23
 
24
+ async function finishLogin() {
25
+ const coreStore = useCoreStore();
26
+ authorize(); // TODO not sure we need this approach with localStorage
27
+ await router.push('/');
28
+ await router.isReady();
29
+ await coreStore.fetchMenuAndResource();
30
+ setTimeout(() => {
31
+ initFlowbite();
32
+
33
+ });
34
+ }
35
+
18
36
  async function logout() {
19
37
  await callAdminForthApi({
20
38
  path: '/logout',
@@ -48,7 +66,8 @@ export const useUserStore = defineStore('user', () => {
48
66
  isAuthorized,
49
67
  authorize,
50
68
  unauthorize,
51
- logout
69
+ logout,
70
+ finishLogin
52
71
  }
53
72
 
54
73
  });
@@ -85,7 +85,6 @@ import { useUserStore } from '@/stores/user';
85
85
  import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
86
86
  import { callAdminForthApi, loadFile } from '@/utils';
87
87
  import { useRouter } from 'vue-router';
88
- import { initFlowbite } from 'flowbite'
89
88
 
90
89
 
91
90
  const router = useRouter();
@@ -120,17 +119,9 @@ async function login() {
120
119
  error.value = resp.error;
121
120
  } else if (resp.redirectTo) {
122
121
  router.push(resp.redirectTo);
123
- }
124
- else {
122
+ } else {
125
123
  error.value = null;
126
- user.authorize()
127
- router.push('/');
128
- await router.isReady();
129
- await coreStore.fetchMenuAndResource();
130
- setTimeout(() => {
131
- initFlowbite();
132
- });
133
-
124
+ await user.finishLogin();
134
125
  }
135
126
 
136
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -207,6 +207,7 @@ class ExpressServer implements IExpressHttpServer {
207
207
  status: 200,
208
208
  message: undefined,
209
209
  setHeader(name, value) {
210
+ process.env.HEAVY_DEBUG && console.log(' 🪲Setting header', name, value);
210
211
  this.headers.push([name, value]);
211
212
  },
212
213
 
package/spa/src/App.vue CHANGED
@@ -294,8 +294,8 @@ watch (()=>coreStore.menu, () => {
294
294
  watch([loggedIn, routerIsReady, loginRedirectCheckIsReady], ([l,r,lr]) => {
295
295
  if (l && r && lr) {
296
296
  setTimeout(() => {
297
- initFlowbite();
298
- });
297
+ initFlowbite();
298
+ });
299
299
  }
300
300
  })
301
301
 
@@ -1,6 +1,12 @@
1
- import {ref} from 'vue';
2
- import {defineStore} from 'pinia';
1
+ import { ref } from 'vue';
2
+ import { defineStore } from 'pinia';
3
3
  import { callAdminForthApi } from '@/utils';
4
+ import { initFlowbite } from 'flowbite'
5
+ import { useRouter } from 'vue-router';
6
+ import { useCoreStore } from './core';
7
+ import router from '@/router';
8
+
9
+
4
10
 
5
11
  export const useUserStore = defineStore('user', () => {
6
12
  const isAuthorized = ref(false);
@@ -15,6 +21,18 @@ export const useUserStore = defineStore('user', () => {
15
21
  localStorage.setItem('isAuthorized', 'false');
16
22
  }
17
23
 
24
+ async function finishLogin() {
25
+ const coreStore = useCoreStore();
26
+ authorize(); // TODO not sure we need this approach with localStorage
27
+ await router.push('/');
28
+ await router.isReady();
29
+ await coreStore.fetchMenuAndResource();
30
+ setTimeout(() => {
31
+ initFlowbite();
32
+
33
+ });
34
+ }
35
+
18
36
  async function logout() {
19
37
  await callAdminForthApi({
20
38
  path: '/logout',
@@ -48,7 +66,8 @@ export const useUserStore = defineStore('user', () => {
48
66
  isAuthorized,
49
67
  authorize,
50
68
  unauthorize,
51
- logout
69
+ logout,
70
+ finishLogin
52
71
  }
53
72
 
54
73
  });
@@ -85,7 +85,6 @@ import { useUserStore } from '@/stores/user';
85
85
  import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
86
86
  import { callAdminForthApi, loadFile } from '@/utils';
87
87
  import { useRouter } from 'vue-router';
88
- import { initFlowbite } from 'flowbite'
89
88
 
90
89
 
91
90
  const router = useRouter();
@@ -120,17 +119,9 @@ async function login() {
120
119
  error.value = resp.error;
121
120
  } else if (resp.redirectTo) {
122
121
  router.push(resp.redirectTo);
123
- }
124
- else {
122
+ } else {
125
123
  error.value = null;
126
- user.authorize()
127
- router.push('/');
128
- await router.isReady();
129
- await coreStore.fetchMenuAndResource();
130
- setTimeout(() => {
131
- initFlowbite();
132
- });
133
-
124
+ await user.finishLogin();
134
125
  }
135
126
 
136
127
  }