adminforth 1.2.7 → 1.2.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/dist/servers/express.js +1 -0
- package/dist/spa/spa/src/App.vue +2 -2
- package/dist/spa/spa/src/stores/user.ts +23 -3
- package/dist/spa/spa/src/views/LoginView.vue +2 -11
- package/package.json +1 -1
- package/servers/express.ts +1 -0
- package/spa/src/App.vue +2 -2
- package/spa/src/stores/user.ts +23 -3
- package/spa/src/views/LoginView.vue +2 -11
package/dist/servers/express.js
CHANGED
package/dist/spa/spa/src/App.vue
CHANGED
|
@@ -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,19 @@ 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
|
+
debugger;
|
|
32
|
+
initFlowbite();
|
|
33
|
+
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
18
37
|
async function logout() {
|
|
19
38
|
await callAdminForthApi({
|
|
20
39
|
path: '/logout',
|
|
@@ -48,7 +67,8 @@ export const useUserStore = defineStore('user', () => {
|
|
|
48
67
|
isAuthorized,
|
|
49
68
|
authorize,
|
|
50
69
|
unauthorize,
|
|
51
|
-
logout
|
|
70
|
+
logout,
|
|
71
|
+
finishLogin
|
|
52
72
|
}
|
|
53
73
|
|
|
54
74
|
});
|
|
@@ -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.
|
|
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
package/servers/express.ts
CHANGED
package/spa/src/App.vue
CHANGED
package/spa/src/stores/user.ts
CHANGED
|
@@ -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,19 @@ 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
|
+
debugger;
|
|
32
|
+
initFlowbite();
|
|
33
|
+
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
18
37
|
async function logout() {
|
|
19
38
|
await callAdminForthApi({
|
|
20
39
|
path: '/logout',
|
|
@@ -48,7 +67,8 @@ export const useUserStore = defineStore('user', () => {
|
|
|
48
67
|
isAuthorized,
|
|
49
68
|
authorize,
|
|
50
69
|
unauthorize,
|
|
51
|
-
logout
|
|
70
|
+
logout,
|
|
71
|
+
finishLogin
|
|
52
72
|
}
|
|
53
73
|
|
|
54
74
|
});
|
|
@@ -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.
|
|
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
|
}
|