mirror of
https://github.com/vbenjs/vben-admin-thin-next.git
synced 2025-01-24 02:00:22 +08:00
fix(router): reserving Redirect
after reset (#126)
After logging out and then logging in, click Refresh to display 404.
This commit is contained in:
parent
cbcd909867
commit
ec7efcf0f0
@ -7,6 +7,7 @@ import { createGuard } from './guard/';
|
|||||||
|
|
||||||
import { basicRoutes } from './routes/';
|
import { basicRoutes } from './routes/';
|
||||||
import { scrollBehavior } from './scrollBehavior';
|
import { scrollBehavior } from './scrollBehavior';
|
||||||
|
import { REDIRECT_NAME } from './constant';
|
||||||
|
|
||||||
export const hashRouter = createWebHashHistory();
|
export const hashRouter = createWebHashHistory();
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ const router = createRouter({
|
|||||||
|
|
||||||
// reset router
|
// reset router
|
||||||
export function resetRouter() {
|
export function resetRouter() {
|
||||||
const resetWhiteNameList = ['Login'];
|
const resetWhiteNameList = ['Login', REDIRECT_NAME];
|
||||||
router.getRoutes().forEach((route) => {
|
router.getRoutes().forEach((route) => {
|
||||||
const { name } = route;
|
const { name } = route;
|
||||||
if (name && !resetWhiteNameList.includes(name as string)) {
|
if (name && !resetWhiteNameList.includes(name as string)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user