From 6810996dee9c22c71e4464903d059e5c52a409ea Mon Sep 17 00:00:00 2001 From: mahendar Date: Mon, 23 Dec 2024 20:00:10 +0530 Subject: [PATCH] removed default --- src/components/Common/AuthorizedButton.tsx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) 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 }) => (