Skip to content

Commit

Permalink
feat(redirect): add full path redirect option (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
manniL authored and pi0 committed Mar 13, 2018
1 parent 9a0dcdb commit ca8785f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion lib/auth/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module.exports = {

rewriteRedirects: true,

fullPathRedirect: false,

redirect: {
login: '/login',
logout: '/',
Expand Down

0 comments on commit ca8785f

Please sign in to comment.