From ec7efcf0f0161c8e14168bf69ba27ba36e2a1ac8 Mon Sep 17 00:00:00 2001 From: ZhaoBin Date: Mon, 14 Dec 2020 15:42:44 +0800 Subject: [PATCH] fix(router): reserving `Redirect` after reset (#126) After logging out and then logging in, click Refresh to display 404. --- src/router/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/router/index.ts b/src/router/index.ts index 6e7d8c5b..5cf1cda4 100644 --- a/src/router/index.ts +++ b/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)) {