Commit 8a745e24436988025a79a49744afd12c560b25b6
Merge branch 'ww' into 'main'
fix: fix clear persist storage bug See merge request huang/yun-teng-iot-front!242
Showing
3 changed files
with
4 additions
and
2 deletions
@@ -38,7 +38,7 @@ export function transformMenuModule(menuModule: MenuModule): Menu { | @@ -38,7 +38,7 @@ export function transformMenuModule(menuModule: MenuModule): Menu { | ||
38 | } | 38 | } |
39 | 39 | ||
40 | export function transformRouteToMenu(routeModList: AppRouteModule[], routerMapping = false) { | 40 | export function transformRouteToMenu(routeModList: AppRouteModule[], routerMapping = false) { |
41 | - const cloneRouteModList = cloneDeep(routeModList); | 41 | + const cloneRouteModList = cloneDeep(routeModList) ?? []; |
42 | const routeList: AppRouteRecordRaw[] = []; | 42 | const routeList: AppRouteRecordRaw[] = []; |
43 | 43 | ||
44 | cloneRouteModList.forEach((item) => { | 44 | cloneRouteModList.forEach((item) => { |
@@ -115,6 +115,7 @@ window.addEventListener('beforeunload', function () { | @@ -115,6 +115,7 @@ window.addEventListener('beforeunload', function () { | ||
115 | REFRESH_TOKEN_KEY, | 115 | REFRESH_TOKEN_KEY, |
116 | USER_INFO_KEY, | 116 | USER_INFO_KEY, |
117 | LOCK_INFO_KEY, | 117 | LOCK_INFO_KEY, |
118 | + ROLES_KEY, | ||
118 | ]), | 119 | ]), |
119 | }); | 120 | }); |
120 | ss.set(APP_SESSION_CACHE_KEY, { | 121 | ss.set(APP_SESSION_CACHE_KEY, { |
@@ -125,6 +126,7 @@ window.addEventListener('beforeunload', function () { | @@ -125,6 +126,7 @@ window.addEventListener('beforeunload', function () { | ||
125 | REFRESH_TOKEN_KEY, | 126 | REFRESH_TOKEN_KEY, |
126 | USER_INFO_KEY, | 127 | USER_INFO_KEY, |
127 | LOCK_INFO_KEY, | 128 | LOCK_INFO_KEY, |
129 | + ROLES_KEY, | ||
128 | ]), | 130 | ]), |
129 | }); | 131 | }); |
130 | }); | 132 | }); |
@@ -128,7 +128,7 @@ export function filter<T = any>( | @@ -128,7 +128,7 @@ export function filter<T = any>( | ||
128 | config = getConfig(config); | 128 | config = getConfig(config); |
129 | const children = config.children as string; | 129 | const children = config.children as string; |
130 | function listFilter(list: T[]) { | 130 | function listFilter(list: T[]) { |
131 | - return list | 131 | + return (list ?? []) |
132 | .map((node: any) => ({ ...node })) | 132 | .map((node: any) => ({ ...node })) |
133 | .filter((node) => { | 133 | .filter((node) => { |
134 | node[children] = node[children] && listFilter(node[children]); | 134 | node[children] = node[children] && listFilter(node[children]); |