diff --git a/docs/options.md b/docs/options.md index 46e48cbe2..4bd1a2414 100644 --- a/docs/options.md +++ b/docs/options.md @@ -66,6 +66,12 @@ If enabled, user will be automatically logged out if any error happens. (For exa If enabled, user will redirect back to the original guarded route instead of `redirect.home`. +### `fullPathRedirect` + +Default: `false` + +If true, use the full route path with query parameters for redirect + ### `vuex.namespace` * Default: `auth` diff --git a/lib/auth/auth.js b/lib/auth/auth.js index 4fbf5d3b9..eb6b36537 100644 --- a/lib/auth/auth.js +++ b/lib/auth/auth.js @@ -435,7 +435,7 @@ export default class Auth { return } - const from = this.ctx.route.path + const from = this.options.fullPathRedirect ? this.ctx.route.path : this.ctx.route.fullPath let to = this.options.redirect[name] if (!to) { diff --git a/lib/defaults.js b/lib/defaults.js index b65618c73..a06b963fb 100644 --- a/lib/defaults.js +++ b/lib/defaults.js @@ -13,6 +13,8 @@ module.exports = { rewriteRedirects: true, + fullPathRedirect: false, + redirect: { login: '/login', logout: '/',