From c329c0b497f31164da2a8c1c0fd492dc091c2b4f Mon Sep 17 00:00:00 2001 From: Hamsini Malli Sivakumar Date: Wed, 6 Sep 2023 17:09:03 -0400 Subject: [PATCH] fixed button + added disabled function --- src/pages/user_profile/RequestRole.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pages/user_profile/RequestRole.js b/src/pages/user_profile/RequestRole.js index 1c084adfd..80c5e62c4 100644 --- a/src/pages/user_profile/RequestRole.js +++ b/src/pages/user_profile/RequestRole.js @@ -31,6 +31,7 @@ export default function RequestRole(props) { } ]; + const [hasSupportRequests, setHasSupportRequests] = useState(false); const [supportRequests, setSupportRequests] = useState({ checkRegisterDataset: false, checkRequestDataAccess: false, @@ -47,6 +48,8 @@ export default function RequestRole(props) { const handleSupportRequestsChange = ({ key, value }) => { let newSupportRequests = Object.assign({}, supportRequests, { [key]: value }); setSupportRequests(newSupportRequests); + const hasAnyRequests = possibleSupportRequests.some(request => newSupportRequests[request.key]); + setHasSupportRequests(hasAnyRequests); }; const submitForm = async (event) => { @@ -160,20 +163,19 @@ export default function RequestRole(props) { ;