From db454ecdf5c91f837f731486b216ed7cd3cde5d2 Mon Sep 17 00:00:00 2001 From: dhruv Date: Thu, 25 Jan 2024 07:54:20 +0530 Subject: [PATCH] Disable create button if user got created --- src/pages/AccessManagement/Users.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pages/AccessManagement/Users.tsx b/src/pages/AccessManagement/Users.tsx index 3c5fda7e..297ea2fc 100644 --- a/src/pages/AccessManagement/Users.tsx +++ b/src/pages/AccessManagement/Users.tsx @@ -51,7 +51,7 @@ const Users: FC = () => { const { getRolesData } = useRole(); - let rows = + const rows = getUserIsSuccess && getUserData?.data ? ( getUserData?.data.map((user: any) => { return ( @@ -88,7 +88,7 @@ const Users: FC = () => { }; const handleCreateUser = () => { - let userRole: any = []; + const userRole: any = []; if (SelectedRole !== '') { userRole.push(SelectedRole); } @@ -99,7 +99,6 @@ const Users: FC = () => { if (getUserData?.data?.includes(createUserInput) || createUserInput.length < 3) { return true; } - if (SelectedRole !== '') { if (getRolesData?.data?.includes(SelectedRole)) { return false; @@ -201,7 +200,7 @@ const Users: FC = () => { color="gray" className={classes.modalActionBtn} onClick={handleCreateUser} - disabled={createVaildtion()}> + disabled={createVaildtion() || !!createUserData?.data}> Create