You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is probably user error, but I am having a bit of trouble getting my head around the package.
The goal that I am trying to achieve is when a user logs in, a JSON file is retrieved via an API, then I'll use that to create my rules. Here is what I currently have.
You can't change ability via this.$ability = . You change it only for your component. All other components will use top level defined ability (from Vue.prototype). That's why your changes don't persist when you switch to another route.
What you need to do is to update ability rules. So, change the part where you update ability to this:
Hi,
This is probably user error, but I am having a bit of trouble getting my head around the package.
The goal that I am trying to achieve is when a user logs in, a JSON file is retrieved via an API, then I'll use that to create my rules. Here is what I currently have.
ability.js
main.js (parts of)
Then in my login page, after it retrieves the JSON object and begins to parse it.
Straight after this, I print out this.$ability, and it's fine, but when I go to my next page, it's returned to the way it was at the start.
As I said, probably user error, or my misunderstanding of the documentation so who knows!
The text was updated successfully, but these errors were encountered: