Commit 6676c9506be7b3095c466c83432d40b2a36565fb
1 parent
7675a9f6
fix: fix the original page after login expired
Showing
3 changed files
with
14 additions
and
11 deletions
CHANGELOG.zh_CN.md
src/router/guard/permissionGuard.ts
... | ... | @@ -40,8 +40,17 @@ export function createPermissionGuard(router: Router) { |
40 | 40 | return; |
41 | 41 | } |
42 | 42 | // redirect login page |
43 | - const redirectPath = to.path ? `${LOGIN_PATH}?redirect=${to.path}` : LOGIN_PATH; | |
44 | - next(redirectPath); | |
43 | + const redirectData: { path: string; replace: boolean; query?: { [key: string]: string } } = { | |
44 | + path: LOGIN_PATH, | |
45 | + replace: true, | |
46 | + }; | |
47 | + if (to.path) { | |
48 | + redirectData.query = { | |
49 | + ...redirectData.query, | |
50 | + redirect: to.path, | |
51 | + }; | |
52 | + } | |
53 | + next(redirectData); | |
45 | 54 | return; |
46 | 55 | } |
47 | 56 | if (permissionStore.getIsDynamicAddedRouteState) { | ... | ... |
yarn.lock
... | ... | @@ -6944,7 +6944,7 @@ rollup@^1.31.1: |
6944 | 6944 | "@types/node" "*" |
6945 | 6945 | acorn "^7.1.0" |
6946 | 6946 | |
6947 | -rollup@^2.32.1, rollup@^2.33.1: | |
6947 | +rollup@^2.32.1: | |
6948 | 6948 | version "2.33.1" |
6949 | 6949 | resolved "https://registry.npmjs.org/rollup/-/rollup-2.33.1.tgz#802795164164ee63cd47769d8879c33ec8ae0c40" |
6950 | 6950 | integrity sha512-uY4O/IoL9oNW8MMcbA5hcOaz6tZTMIh7qJHx/tzIJm+n1wLoY38BLn6fuy7DhR57oNFLMbDQtDeJoFURt5933w== |
... | ... | @@ -8162,14 +8162,6 @@ vfile@^4.0.0: |
8162 | 8162 | unist-util-stringify-position "^2.0.0" |
8163 | 8163 | vfile-message "^2.0.0" |
8164 | 8164 | |
8165 | -vite-plugin-cdn@^1.0.0-beta.3: | |
8166 | - version "1.0.0-beta.3" | |
8167 | - resolved "https://registry.npmjs.org/vite-plugin-cdn/-/vite-plugin-cdn-1.0.0-beta.3.tgz#5846e80debba5e3968169931f5cba86aea5701cd" | |
8168 | - integrity sha512-1oepxSSr8rROFhyP93EWVasKHAAbGfp3QyUrUmJW/zU80CvFPyHATckk8vy08pMiulErSqATjfofTJ+TxP4wkw== | |
8169 | - dependencies: | |
8170 | - lodash "^4.17.20" | |
8171 | - rollup "^2.33.1" | |
8172 | - | |
8173 | 8165 | vite-plugin-html@^1.0.0-beta.2: |
8174 | 8166 | version "1.0.0-beta.2" |
8175 | 8167 | resolved "https://registry.npmjs.org/vite-plugin-html/-/vite-plugin-html-1.0.0-beta.2.tgz#f30cdba4ca70469e62b770e32c407ce5d7f9b544" | ... | ... |