Skip to content

Vue not implemented correctly #546

Closed Answered by stalniy
matze1708 asked this question in Q&A
Discussion options

You must be logged in to vote

You just incorrectly update Ability, do this instead:

let ability = new Ability([]);

if (store.getters['profile/loggedIn']) {
    store.dispatch('profile/getCurrent')
        .then(() => {
            ability.update(defineAbilitiesFor(store.state.profile.roles));
        })
        .catch((error) => {
            ability.update(defineAbilitiesFor(store.state.profile.roles));
            console.log(`Error while requesting user: ${error}`);
        });
} else {
    ability.update(defineAbilitiesFor(store.state.profile.roles));
}
Vue.use(abilitiesPlugin, ability);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by stalniy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants