on-internet
← Community

Implementing CASL with React and Redux

Stack Overflow ·

I will be referencing this article https://medium.com/dailyjs/managing-user-permissions-in-your-react-app-a93a94ff9b40 I will be implementing role based authentication for certain routes in my react application and came across CASL. I see they have a react implementation but theres a certain area which confuses me. Please see the below code and I will explain after. import { AbilityBuilder } from 'casl' function subjectName(item) { if (!item || typeof item === 'string') { return item } return item.__type } export default AbilityBuilder.define({ subjectName }, can => { can(['read', 'create'], '

Comments

Sign in or sign up to comment and upvote.

No comments yet.