@websanova/vue-auth
Advanced tools
Comparing version 2.4.0-beta to 2.4.1-beta
@@ -17,3 +17,3 @@ { | ||
"version": "2.4.0-beta", | ||
"version": "2.4.1-beta", | ||
@@ -28,3 +28,3 @@ "repository": { | ||
"dependencies": { | ||
"@websanova/vue-auth": "2.4.0-beta" | ||
"@websanova/vue-auth": "2.4.1-beta" | ||
}, | ||
@@ -31,0 +31,0 @@ |
@@ -440,2 +440,32 @@ # Vue Auth | ||
### transition | ||
* Fetch the state of the transition as vue-auth sees it. | ||
* Useful for doing redirects when accessing restricted routes. | ||
The transitions come in five states: | ||
* **logged-out-hidden** - The user is logged out and accessing a log in required page. | ||
* **logged-out-visible** - The user is logged out and accessing a public page. | ||
* **logged-in-forbidden** - Logged in but without access to that page. | ||
* **logged-in-visible** - Logged in and accessing a page visible to any logged in user. | ||
* **logged-in-hidden** - Logged in and accessing a hidden page, for instance the login page while logged in. | ||
The function is primarily useful for setting a redirect url if trying to access a private page when logged out. | ||
In the root component (1.x example): | ||
~~~ | ||
ready() { | ||
this.$router.beforeEach(function (transition) { | ||
if (_this.$auth.transition().from === 'logged-out-hidden') { | ||
_this.$router.go({path: '/login', query: {redirect_url: _this.$route.path}}); | ||
} | ||
else { | ||
transition.next(); | ||
} | ||
}); | ||
} | ||
~~~ | ||
### user | ||
@@ -442,0 +472,0 @@ |
@@ -21,2 +21,3 @@ var Auth = require('./auth.js')(); | ||
get: function () { | ||
auth.ready = ready.bind(this); | ||
auth.login = login.bind(this); | ||
@@ -23,0 +24,0 @@ auth.fetch = fetch.bind(this); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
390861
3288
885