瀏覽代碼

fix(router): reserving `Redirect` after reset (#126)

After logging out and then logging in, click Refresh to display 404.
ZhaoBin 4 年之前
父節點
當前提交
ec7efcf0f0
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/router/index.ts

+ 2 - 1
src/router/index.ts

@@ -7,6 +7,7 @@ import { createGuard } from './guard/';
 
 import { basicRoutes } from './routes/';
 import { scrollBehavior } from './scrollBehavior';
+import { REDIRECT_NAME } from './constant';
 
 export const hashRouter = createWebHashHistory();
 
@@ -20,7 +21,7 @@ const router = createRouter({
 
 // reset router
 export function resetRouter() {
-  const resetWhiteNameList = ['Login'];
+  const resetWhiteNameList = ['Login', REDIRECT_NAME];
   router.getRoutes().forEach((route) => {
     const { name } = route;
     if (name && !resetWhiteNameList.includes(name as string)) {