diff --git a/src/components/Common/AuthorizedButton.tsx b/src/components/Common/AuthorizedButton.tsx index 4eefb2afdfa..944ff89532a 100644 --- a/src/components/Common/AuthorizedButton.tsx +++ b/src/components/Common/AuthorizedButton.tsx @@ -4,19 +4,15 @@ import AuthorizedChild from "@/CAREUI/misc/AuthorizedChild"; import { Button, ButtonProps } from "@/components/ui/button"; -import { AuthorizedElementProps } from "@/Utils/AuthorizeFor"; +import { AuthorizedElementProps, AuthorizedForCB } from "@/Utils/AuthorizeFor"; -const AuthorizedButton: React.FC = ({ - authorizeFor, - ...props -}) => { - if (!authorizeFor) { - throw new Error( - "The 'authorizeFor' prop is required for AuthorizedButton.", - ); - } +type AuthorizedButtonProps = Omit & { + authorizeFor: AuthorizedForCB; +} & ButtonProps; + +const AuthorizedButton: React.FC = (props) => { return ( - + {({ isAuthorized }) => (