Skip to content

Commit ca8785f

Browse files
TheAlexLichterpi0
authored andcommitted
feat(redirect): add full path redirect option (#96)
1 parent 9a0dcdb commit ca8785f

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

docs/options.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ If enabled, user will be automatically logged out if any error happens. (For exa
6666

6767
If enabled, user will redirect back to the original guarded route instead of `redirect.home`.
6868

69+
### `fullPathRedirect`
70+
71+
Default: `false`
72+
73+
If true, use the full route path with query parameters for redirect
74+
6975
### `vuex.namespace`
7076

7177
* Default: `auth`

lib/auth/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ export default class Auth {
435435
return
436436
}
437437

438-
const from = this.ctx.route.path
438+
const from = this.options.fullPathRedirect ? this.ctx.route.path : this.ctx.route.fullPath
439439

440440
let to = this.options.redirect[name]
441441
if (!to) {

lib/defaults.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ module.exports = {
1313

1414
rewriteRedirects: true,
1515

16+
fullPathRedirect: false,
17+
1618
redirect: {
1719
login: '/login',
1820
logout: '/',

0 commit comments

Comments
 (0)