[Vuejs]-Error in using casl for role based permission

4👍

You return a function from config/ability but Vue.use expects to receive an Ability instance.

The error says that something trying to access on property on the t, where t is an argument of abilitiesPlugin function from @casl/vue.

So, replace the line Vue.use(abilitiesPlugin, ability); with Vue.use(abilitiesPlugin, ability()); in main.js . This should fix the error.

P.S.: make sure to use the latest version. AbilityBuilder.define is removed from CASL v4

Leave a comment