cosey 0.10.21 → 0.10.22
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/config/api.d.ts +0 -4
- package/config/api.js +0 -4
- package/config/index.d.ts +7 -3
- package/config/index.js +2 -2
- package/layout/layout-user-menu/layout-user-menu.vue.js +1 -1
- package/package.json +1 -1
- package/router/guard/auth.js +11 -20
- package/router/utils.js +1 -1
- package/store/layout.d.ts +10 -16
- package/store/user.d.ts +18 -32
- package/store/user.js +41 -38
package/config/api.d.ts
CHANGED
package/config/api.js
CHANGED
package/config/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { type PersistConfig } from './persist';
|
|
|
8
8
|
import { type I18nConfig } from './i18n';
|
|
9
9
|
import { type RouteRecordRaw } from 'vue-router';
|
|
10
10
|
import { type CoseyRouterOptions } from '../router';
|
|
11
|
+
import { type UserInfo } from '../store';
|
|
11
12
|
export interface LayoutComponents {
|
|
12
13
|
base?: string | Component;
|
|
13
14
|
sidebar?: string | Component;
|
|
@@ -48,15 +49,18 @@ export interface LayoutSlots {
|
|
|
48
49
|
afterToggle?: () => VNodeChild;
|
|
49
50
|
}
|
|
50
51
|
type FilterRouteHandler = (route: RouteRecordRaw) => RouteRecordRaw | void | boolean | undefined | null;
|
|
51
|
-
type
|
|
52
|
+
type InitializeDataHandler = (handlers: {
|
|
53
|
+
setUserInfo: (userInfo: UserInfo) => void;
|
|
54
|
+
setRoutes: (route: RouteRecordRaw | RouteRecordRaw[]) => void;
|
|
55
|
+
}) => void | Promise<void>;
|
|
52
56
|
export type CoseyOptions = {
|
|
53
57
|
router?: CoseyRouterOptions & RouterConfig;
|
|
54
58
|
http?: HttpConfig;
|
|
55
59
|
layout?: LayoutConfig;
|
|
56
60
|
site?: SiteConfig;
|
|
57
61
|
api?: ApiConfig;
|
|
62
|
+
initializeData?: InitializeDataHandler;
|
|
58
63
|
filterRoute?: FilterRouteHandler;
|
|
59
|
-
defineAuthority?: DefineAuthorityHandler;
|
|
60
64
|
components?: LayoutComponents;
|
|
61
65
|
slots?: LayoutSlots;
|
|
62
66
|
persist?: PersistConfig;
|
|
@@ -68,8 +72,8 @@ export interface GlobalConfig {
|
|
|
68
72
|
layout: RequiredLayoutConfig;
|
|
69
73
|
site: RequiredSiteConfig;
|
|
70
74
|
api: RequiredApiConfig;
|
|
75
|
+
initializeData: NonNullable<CoseyOptions['initializeData']>;
|
|
71
76
|
filterRoute: NonNullable<CoseyOptions['filterRoute']>;
|
|
72
|
-
defineAuthority: NonNullable<CoseyOptions['defineAuthority']>;
|
|
73
77
|
components: NonNullable<CoseyOptions['components']>;
|
|
74
78
|
slots: NonNullable<CoseyOptions['slots']>;
|
|
75
79
|
}
|
package/config/index.js
CHANGED
|
@@ -17,8 +17,8 @@ function launchGlobalConfig(app, options) {
|
|
|
17
17
|
layout = {},
|
|
18
18
|
site = {},
|
|
19
19
|
api = {},
|
|
20
|
+
initializeData = () => void 0,
|
|
20
21
|
filterRoute = () => true,
|
|
21
|
-
defineAuthority = () => void 0,
|
|
22
22
|
components = {},
|
|
23
23
|
slots = {},
|
|
24
24
|
persist = {},
|
|
@@ -30,8 +30,8 @@ function launchGlobalConfig(app, options) {
|
|
|
30
30
|
layout: defaultsDeep(layout, defaultLayoutConfig),
|
|
31
31
|
site: defaultsDeep(site, defaultSiteConfig),
|
|
32
32
|
api: defaultsDeep(api, defaultApiConfig),
|
|
33
|
+
initializeData,
|
|
33
34
|
filterRoute,
|
|
34
|
-
defineAuthority,
|
|
35
35
|
components,
|
|
36
36
|
slots
|
|
37
37
|
};
|
|
@@ -46,7 +46,7 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
46
46
|
lock: true,
|
|
47
47
|
text: t("co.auth.loggingOut")
|
|
48
48
|
});
|
|
49
|
-
userStore.logout().finally(() => {
|
|
49
|
+
userStore.logout(router.currentRoute.value.fullPath).finally(() => {
|
|
50
50
|
fullscreenLoading.value = false;
|
|
51
51
|
loading.close();
|
|
52
52
|
});
|
package/package.json
CHANGED
package/router/guard/auth.js
CHANGED
|
@@ -4,7 +4,6 @@ import { TOKEN_NAME, ROUTER_TO } from '../../constant.js';
|
|
|
4
4
|
import { persist } from '../../persist/index.js';
|
|
5
5
|
|
|
6
6
|
function registerAuthGuard(router) {
|
|
7
|
-
let firstTimeAddRoutes = false;
|
|
8
7
|
router.beforeEach(async (to) => {
|
|
9
8
|
const { router: routerConfig } = globalConfig;
|
|
10
9
|
const token = persist.get(TOKEN_NAME);
|
|
@@ -13,14 +12,11 @@ function registerAuthGuard(router) {
|
|
|
13
12
|
return routerConfig.homePath;
|
|
14
13
|
}
|
|
15
14
|
if (token) {
|
|
16
|
-
if (!userStore.
|
|
15
|
+
if (!userStore.initialized) {
|
|
17
16
|
try {
|
|
18
17
|
persist.set(ROUTER_TO, to.fullPath);
|
|
19
|
-
await userStore.
|
|
20
|
-
|
|
21
|
-
await userStore.addDynamicRoutes();
|
|
22
|
-
firstTimeAddRoutes = true;
|
|
23
|
-
userStore.requestedUserInfo = true;
|
|
18
|
+
await userStore.initializeData();
|
|
19
|
+
return to.fullPath;
|
|
24
20
|
} catch {
|
|
25
21
|
return false;
|
|
26
22
|
} finally {
|
|
@@ -30,21 +26,16 @@ function registerAuthGuard(router) {
|
|
|
30
26
|
if (to.path === routerConfig.loginPath) {
|
|
31
27
|
return routerConfig.homePath;
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return
|
|
29
|
+
} else {
|
|
30
|
+
if (to.meta.authentication) {
|
|
31
|
+
return {
|
|
32
|
+
path: routerConfig.loginPath,
|
|
33
|
+
query: {
|
|
34
|
+
redirect: to.path
|
|
35
|
+
}
|
|
36
|
+
};
|
|
36
37
|
}
|
|
37
|
-
return true;
|
|
38
38
|
}
|
|
39
|
-
if (!to.meta.authentication) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
path: routerConfig.loginPath,
|
|
44
|
-
query: {
|
|
45
|
-
redirect: to.path
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
39
|
});
|
|
49
40
|
}
|
|
50
41
|
|
package/router/utils.js
CHANGED
|
@@ -30,7 +30,7 @@ function defineRoutes(route) {
|
|
|
30
30
|
}
|
|
31
31
|
const mergeRouteModules = (modules) => {
|
|
32
32
|
return Object.keys(modules).reduce((result, key) => {
|
|
33
|
-
const module = modules[key].default;
|
|
33
|
+
const module = modules[key].default || [];
|
|
34
34
|
return result.concat(module);
|
|
35
35
|
}, []);
|
|
36
36
|
};
|
package/store/layout.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ export declare const useLayoutStore: import("pinia").StoreDefinition<"cosey-layo
|
|
|
165
165
|
topbarHeight: import("vue").Ref<number, number>;
|
|
166
166
|
tabbarHeight: import("vue").Ref<number, number>;
|
|
167
167
|
headerHeight: import("vue").ComputedRef<number>;
|
|
168
|
-
}, "menus" | "keepAlive" | "
|
|
168
|
+
}, "menus" | "keepAlive" | "includeHorizontal" | "isVertical" | "isBiserial" | "isHorizontal" | "isHorizontalVertical" | "isHorizontalBiserial" | "menusMap" | "firstLevelMenus" | "secondLevelMenus" | "thirdLevelMenus" | "topMenus" | "snugMenus" | "snugActive" | "defaultMenus" | "iframeTabList" | "keepAliveExclude" | "sidebarWidth" | "headerHeight">, Pick<{
|
|
169
169
|
sidebarVisible: import("vue").Ref<boolean, boolean>;
|
|
170
170
|
collapse: import("vue").Ref<boolean, boolean>;
|
|
171
171
|
isMobile: import("vue").Ref<boolean, boolean>;
|
|
@@ -249,31 +249,25 @@ export declare const useLayoutStore: import("pinia").StoreDefinition<"cosey-layo
|
|
|
249
249
|
export declare const useOuterLayoutStore: (hot?: StoreGeneric) => import("pinia").Store<"cosey-user", Pick<{
|
|
250
250
|
dynamicRoutes: import("vue").ShallowRef<any[], any[]>;
|
|
251
251
|
userInfo: import("vue").Ref<import("./user").UserInfo | undefined, import("./user").UserInfo | undefined>;
|
|
252
|
-
|
|
252
|
+
initialized: import("vue").ComputedRef<boolean>;
|
|
253
253
|
login: (data: any) => Promise<void>;
|
|
254
|
-
|
|
254
|
+
initializeData: () => Promise<void>;
|
|
255
255
|
changePassword: (data: any) => Promise<void>;
|
|
256
|
-
setAuthorization: () => Promise<void>;
|
|
257
|
-
addDynamicRoutes: () => Promise<void>;
|
|
258
256
|
logout: (lastPath?: string) => Promise<void>;
|
|
259
|
-
}, "dynamicRoutes" | "userInfo"
|
|
257
|
+
}, "dynamicRoutes" | "userInfo">, Pick<{
|
|
260
258
|
dynamicRoutes: import("vue").ShallowRef<any[], any[]>;
|
|
261
259
|
userInfo: import("vue").Ref<import("./user").UserInfo | undefined, import("./user").UserInfo | undefined>;
|
|
262
|
-
|
|
260
|
+
initialized: import("vue").ComputedRef<boolean>;
|
|
263
261
|
login: (data: any) => Promise<void>;
|
|
264
|
-
|
|
262
|
+
initializeData: () => Promise<void>;
|
|
265
263
|
changePassword: (data: any) => Promise<void>;
|
|
266
|
-
setAuthorization: () => Promise<void>;
|
|
267
|
-
addDynamicRoutes: () => Promise<void>;
|
|
268
264
|
logout: (lastPath?: string) => Promise<void>;
|
|
269
|
-
},
|
|
265
|
+
}, "initialized">, Pick<{
|
|
270
266
|
dynamicRoutes: import("vue").ShallowRef<any[], any[]>;
|
|
271
267
|
userInfo: import("vue").Ref<import("./user").UserInfo | undefined, import("./user").UserInfo | undefined>;
|
|
272
|
-
|
|
268
|
+
initialized: import("vue").ComputedRef<boolean>;
|
|
273
269
|
login: (data: any) => Promise<void>;
|
|
274
|
-
|
|
270
|
+
initializeData: () => Promise<void>;
|
|
275
271
|
changePassword: (data: any) => Promise<void>;
|
|
276
|
-
setAuthorization: () => Promise<void>;
|
|
277
|
-
addDynamicRoutes: () => Promise<void>;
|
|
278
272
|
logout: (lastPath?: string) => Promise<void>;
|
|
279
|
-
}, "changePassword" | "login" | "logout" | "
|
|
273
|
+
}, "changePassword" | "login" | "logout" | "initializeData">>;
|
package/store/user.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { type StoreGeneric } from 'pinia';
|
|
2
2
|
export interface UserInfo {
|
|
3
|
-
id?: number;
|
|
4
|
-
username?: string;
|
|
5
3
|
nickname: string;
|
|
6
4
|
avatar: string;
|
|
7
5
|
[key: PropertyKey]: any;
|
|
@@ -9,62 +7,50 @@ export interface UserInfo {
|
|
|
9
7
|
export declare const useUserStore: import("pinia").StoreDefinition<"cosey-user", Pick<{
|
|
10
8
|
dynamicRoutes: import("vue").ShallowRef<any[], any[]>;
|
|
11
9
|
userInfo: import("vue").Ref<UserInfo | undefined, UserInfo | undefined>;
|
|
12
|
-
|
|
10
|
+
initialized: import("vue").ComputedRef<boolean>;
|
|
13
11
|
login: (data: any) => Promise<void>;
|
|
14
|
-
|
|
12
|
+
initializeData: () => Promise<void>;
|
|
15
13
|
changePassword: (data: any) => Promise<void>;
|
|
16
|
-
setAuthorization: () => Promise<void>;
|
|
17
|
-
addDynamicRoutes: () => Promise<void>;
|
|
18
14
|
logout: (lastPath?: string) => Promise<void>;
|
|
19
|
-
}, "dynamicRoutes" | "userInfo"
|
|
15
|
+
}, "dynamicRoutes" | "userInfo">, Pick<{
|
|
20
16
|
dynamicRoutes: import("vue").ShallowRef<any[], any[]>;
|
|
21
17
|
userInfo: import("vue").Ref<UserInfo | undefined, UserInfo | undefined>;
|
|
22
|
-
|
|
18
|
+
initialized: import("vue").ComputedRef<boolean>;
|
|
23
19
|
login: (data: any) => Promise<void>;
|
|
24
|
-
|
|
20
|
+
initializeData: () => Promise<void>;
|
|
25
21
|
changePassword: (data: any) => Promise<void>;
|
|
26
|
-
setAuthorization: () => Promise<void>;
|
|
27
|
-
addDynamicRoutes: () => Promise<void>;
|
|
28
22
|
logout: (lastPath?: string) => Promise<void>;
|
|
29
|
-
},
|
|
23
|
+
}, "initialized">, Pick<{
|
|
30
24
|
dynamicRoutes: import("vue").ShallowRef<any[], any[]>;
|
|
31
25
|
userInfo: import("vue").Ref<UserInfo | undefined, UserInfo | undefined>;
|
|
32
|
-
|
|
26
|
+
initialized: import("vue").ComputedRef<boolean>;
|
|
33
27
|
login: (data: any) => Promise<void>;
|
|
34
|
-
|
|
28
|
+
initializeData: () => Promise<void>;
|
|
35
29
|
changePassword: (data: any) => Promise<void>;
|
|
36
|
-
setAuthorization: () => Promise<void>;
|
|
37
|
-
addDynamicRoutes: () => Promise<void>;
|
|
38
30
|
logout: (lastPath?: string) => Promise<void>;
|
|
39
|
-
}, "changePassword" | "login" | "logout" | "
|
|
31
|
+
}, "changePassword" | "login" | "logout" | "initializeData">>;
|
|
40
32
|
export declare const useOuterUserStore: (hot?: StoreGeneric) => import("pinia").Store<"cosey-user", Pick<{
|
|
41
33
|
dynamicRoutes: import("vue").ShallowRef<any[], any[]>;
|
|
42
34
|
userInfo: import("vue").Ref<UserInfo | undefined, UserInfo | undefined>;
|
|
43
|
-
|
|
35
|
+
initialized: import("vue").ComputedRef<boolean>;
|
|
44
36
|
login: (data: any) => Promise<void>;
|
|
45
|
-
|
|
37
|
+
initializeData: () => Promise<void>;
|
|
46
38
|
changePassword: (data: any) => Promise<void>;
|
|
47
|
-
setAuthorization: () => Promise<void>;
|
|
48
|
-
addDynamicRoutes: () => Promise<void>;
|
|
49
39
|
logout: (lastPath?: string) => Promise<void>;
|
|
50
|
-
}, "dynamicRoutes" | "userInfo"
|
|
40
|
+
}, "dynamicRoutes" | "userInfo">, Pick<{
|
|
51
41
|
dynamicRoutes: import("vue").ShallowRef<any[], any[]>;
|
|
52
42
|
userInfo: import("vue").Ref<UserInfo | undefined, UserInfo | undefined>;
|
|
53
|
-
|
|
43
|
+
initialized: import("vue").ComputedRef<boolean>;
|
|
54
44
|
login: (data: any) => Promise<void>;
|
|
55
|
-
|
|
45
|
+
initializeData: () => Promise<void>;
|
|
56
46
|
changePassword: (data: any) => Promise<void>;
|
|
57
|
-
setAuthorization: () => Promise<void>;
|
|
58
|
-
addDynamicRoutes: () => Promise<void>;
|
|
59
47
|
logout: (lastPath?: string) => Promise<void>;
|
|
60
|
-
},
|
|
48
|
+
}, "initialized">, Pick<{
|
|
61
49
|
dynamicRoutes: import("vue").ShallowRef<any[], any[]>;
|
|
62
50
|
userInfo: import("vue").Ref<UserInfo | undefined, UserInfo | undefined>;
|
|
63
|
-
|
|
51
|
+
initialized: import("vue").ComputedRef<boolean>;
|
|
64
52
|
login: (data: any) => Promise<void>;
|
|
65
|
-
|
|
53
|
+
initializeData: () => Promise<void>;
|
|
66
54
|
changePassword: (data: any) => Promise<void>;
|
|
67
|
-
setAuthorization: () => Promise<void>;
|
|
68
|
-
addDynamicRoutes: () => Promise<void>;
|
|
69
55
|
logout: (lastPath?: string) => Promise<void>;
|
|
70
|
-
}, "changePassword" | "login" | "logout" | "
|
|
56
|
+
}, "changePassword" | "login" | "logout" | "initializeData">>;
|
package/store/user.js
CHANGED
|
@@ -1,54 +1,37 @@
|
|
|
1
|
-
import { shallowRef, ref } from 'vue';
|
|
1
|
+
import { shallowRef, ref, computed } from 'vue';
|
|
2
2
|
import { defineStore } from 'pinia';
|
|
3
|
-
import {
|
|
3
|
+
import { router, getAllDynamicRoutes } from '../router/index.js';
|
|
4
4
|
import { TOKEN_NAME } from '../constant.js';
|
|
5
5
|
import { NOT_FOUND_ROUTE_NAME, NotFoundRoute } from '../router/not-found.js';
|
|
6
6
|
import { persist } from '../persist/index.js';
|
|
7
7
|
import { pinia } from './pinia.js';
|
|
8
8
|
import { globalConfig } from '../config/index.js';
|
|
9
|
+
import { defineRoutes } from '../router/utils.js';
|
|
9
10
|
import { warningOnce } from '../utils/warning.js';
|
|
10
11
|
|
|
11
12
|
const useUserStore = defineStore("cosey-user", () => {
|
|
12
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
router: routerConfig,
|
|
15
|
+
api: apiConfig,
|
|
16
|
+
filterRoute,
|
|
17
|
+
initializeData: _initializeData
|
|
18
|
+
} = globalConfig;
|
|
13
19
|
if (!apiConfig?.login) {
|
|
14
20
|
warningOnce(!!apiConfig?.login, 'The "login" api is required.');
|
|
15
21
|
}
|
|
16
|
-
if (!apiConfig?.getUserInfo) {
|
|
17
|
-
warningOnce(!!apiConfig?.getUserInfo, 'The "getUserInfo" api is required.');
|
|
18
|
-
}
|
|
19
22
|
const loginApi = apiConfig?.login;
|
|
20
|
-
const getUserInfoApi = apiConfig?.getUserInfo;
|
|
21
23
|
const changePasswordApi = apiConfig?.changePassword;
|
|
22
24
|
const logoutApi = apiConfig?.logout;
|
|
23
25
|
const dynamicRoutes = shallowRef([]);
|
|
26
|
+
const remoteDynamicRoutes = shallowRef([]);
|
|
24
27
|
const userInfo = ref();
|
|
25
|
-
const
|
|
28
|
+
const initialized = ref(false);
|
|
26
29
|
const login = async (data) => {
|
|
27
30
|
await loginApi?.(data).then((token) => {
|
|
28
31
|
persist.set(TOKEN_NAME, token);
|
|
29
32
|
router.push(router.currentRoute.value.query.redirect || routerConfig.homePath);
|
|
30
33
|
});
|
|
31
34
|
};
|
|
32
|
-
const getUserInfo = async () => {
|
|
33
|
-
return getUserInfoApi?.().then((res) => {
|
|
34
|
-
const nickname = res.nickname;
|
|
35
|
-
const avatar = res.avatar;
|
|
36
|
-
userInfo.value = {
|
|
37
|
-
...res,
|
|
38
|
-
nickname,
|
|
39
|
-
avatar
|
|
40
|
-
};
|
|
41
|
-
return userInfo.value;
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
const changePassword = async (data) => {
|
|
45
|
-
await changePasswordApi?.(data).then(() => {
|
|
46
|
-
router.back();
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
const setAuthorization = async () => {
|
|
50
|
-
return defineAuthority(userInfo.value);
|
|
51
|
-
};
|
|
52
35
|
const mapRoute = (routes) => {
|
|
53
36
|
return routes.map((route) => {
|
|
54
37
|
const result = filterRoute(route);
|
|
@@ -63,7 +46,7 @@ const useUserStore = defineStore("cosey-user", () => {
|
|
|
63
46
|
return mapRoute(routes);
|
|
64
47
|
};
|
|
65
48
|
const addDynamicRoutes = async () => {
|
|
66
|
-
const filteredRoutes = filterRoutes(getAllDynamicRoutes());
|
|
49
|
+
const filteredRoutes = filterRoutes([...getAllDynamicRoutes(), ...remoteDynamicRoutes.value]);
|
|
67
50
|
router.removeRoute(NOT_FOUND_ROUTE_NAME);
|
|
68
51
|
filteredRoutes.forEach((route) => {
|
|
69
52
|
router.addRoute(route);
|
|
@@ -71,20 +54,42 @@ const useUserStore = defineStore("cosey-user", () => {
|
|
|
71
54
|
router.addRoute("Exception", NotFoundRoute);
|
|
72
55
|
dynamicRoutes.value = filteredRoutes;
|
|
73
56
|
};
|
|
57
|
+
const initializeData = async () => {
|
|
58
|
+
const setUserInfo = (_userInfo) => {
|
|
59
|
+
userInfo.value = _userInfo;
|
|
60
|
+
};
|
|
61
|
+
const setRoutes = (route) => {
|
|
62
|
+
remoteDynamicRoutes.value = defineRoutes(route);
|
|
63
|
+
};
|
|
64
|
+
if (!initialized.value) {
|
|
65
|
+
await _initializeData({
|
|
66
|
+
setUserInfo,
|
|
67
|
+
setRoutes
|
|
68
|
+
});
|
|
69
|
+
await addDynamicRoutes();
|
|
70
|
+
initialized.value = true;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const changePassword = async (data) => {
|
|
74
|
+
await changePasswordApi?.(data).then(() => {
|
|
75
|
+
router.back();
|
|
76
|
+
});
|
|
77
|
+
};
|
|
74
78
|
const flush = async (lastPath) => {
|
|
75
79
|
persist.remove(TOKEN_NAME);
|
|
76
80
|
userInfo.value = void 0;
|
|
77
|
-
|
|
81
|
+
dynamicRoutes.value.forEach((route) => {
|
|
82
|
+
router.removeRoute(route.name);
|
|
83
|
+
});
|
|
84
|
+
dynamicRoutes.value = [];
|
|
85
|
+
remoteDynamicRoutes.value = [];
|
|
86
|
+
initialized.value = false;
|
|
78
87
|
await router.push({
|
|
79
88
|
path: routerConfig.loginPath,
|
|
80
89
|
query: {
|
|
81
90
|
redirect: lastPath
|
|
82
91
|
}
|
|
83
92
|
});
|
|
84
|
-
dynamicRoutes.value.forEach((route) => {
|
|
85
|
-
router.removeRoute(route.name);
|
|
86
|
-
});
|
|
87
|
-
dynamicRoutes.value = [];
|
|
88
93
|
};
|
|
89
94
|
const logout = async (lastPath) => {
|
|
90
95
|
await logoutApi?.();
|
|
@@ -93,12 +98,10 @@ const useUserStore = defineStore("cosey-user", () => {
|
|
|
93
98
|
return {
|
|
94
99
|
dynamicRoutes,
|
|
95
100
|
userInfo,
|
|
96
|
-
|
|
101
|
+
initialized: computed(() => initialized.value),
|
|
97
102
|
login,
|
|
98
|
-
|
|
103
|
+
initializeData,
|
|
99
104
|
changePassword,
|
|
100
|
-
setAuthorization,
|
|
101
|
-
addDynamicRoutes,
|
|
102
105
|
logout
|
|
103
106
|
};
|
|
104
107
|
});
|