feat: introduce propTypes
This commit is contained in:

committed by
Ali BARIN

parent
bfc7d5d0dd
commit
7afdf43872
@@ -1,7 +1,18 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { Can as OriginalCan } from '@casl/react';
|
||||
import * as React from 'react';
|
||||
import useCurrentUserAbility from 'hooks/useCurrentUserAbility';
|
||||
export default function Can(props) {
|
||||
|
||||
function Can(props) {
|
||||
const currentUserAbility = useCurrentUserAbility();
|
||||
return <OriginalCan ability={currentUserAbility} {...props} />;
|
||||
}
|
||||
|
||||
Can.propTypes = {
|
||||
I: PropTypes.string.isRequired,
|
||||
a: PropTypes.string,
|
||||
an: PropTypes.string,
|
||||
passThrough: PropTypes.bool,
|
||||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
|
||||
};
|
||||
|
||||
export default Can;
|
||||
|
Reference in New Issue
Block a user