1import { AbilityBuilder } from 'casl'
2
3function subjectName(item) {
4if (!item || typeof item === 'string') {
5 return item
6 }
7return item.__type
8}
9export default AbilityBuilder.define({ subjectName }, can => {
10 can(['read', 'create'], 'Todo')
11 can(['update', 'delete'], 'Todo', { assignee: 'me' })
12});