williamcruzme / vue-gates

🔒 A Vue.js & Nuxt.js plugin that allows you to use roles and permissions in your components or DOM elements, also compatible as middleware and methods.

Home Page:https://williamcruzme.github.io/vue-gates/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Just asking for clarification and suggestion

eokwukwe opened this issue · comments

Hello @williamcruzme

Solution
Set the permissions/roles when you log in (before redirect), and enable persistent feature:

Vue.use(LaravelPermissions, { persistent: true });

Recommend solution
Work with Nuxt.js, you set the permissions/roles on the server side.

Originally posted by @williamcruzme in #15 (comment)

@williamcruzme How can the Recommend solution be implemented. I am having the same situation as mentioned in the issue. Although setting persistence to true seems to solve the problem, do you think it is the best idea to store user permissions in localStorage. Also, I noticed that the localStorage is not cleared when the user logs out.