MSP-3106 refactor CatEdit component

This commit is contained in:
mikheykinnv committed 2024-04-24 11:54:18 +08:00
1 parent 4a9c263646
commit d31c8b085f
1 file changed
+3 -3
+16
View File
@@ -0,0 +1,16 @@
import { PropsWithChildren } from 'react'
import { useRole } from '@hooks/useRole.tsx'
import { PermissionKeysType } from '@type/roles.type.ts'
const CanEdit = ({ children }: PropsWithChildren) => {
const { hasPermission } = useRole()
if (hasPermission(PermissionKeysType.write)) {
return <>{children}</>
}
return null
}
export default CanEdit