Skip to content

Commit

Permalink
fix(router): reserving Redirect after reset (#126)
Browse files Browse the repository at this point in the history
After logging out and then logging in, click Refresh to display 404.
  • Loading branch information
FuckDoctors authored Dec 14, 2020
1 parent cbcd909 commit ec7efcf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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)) {
Expand Down

0 comments on commit ec7efcf

Please sign in to comment.