diff --git a/frontend/src/components/Nav.tsx b/frontend/src/components/Nav.tsx index 232df2e..545883b 100644 --- a/frontend/src/components/Nav.tsx +++ b/frontend/src/components/Nav.tsx @@ -17,6 +17,7 @@ export function Nav() { const [theme, setTheme] = useState('light'); const [showModal, setShowModal] = useState(false); const [publishedDCR, setPublishedDCR]: any = useState(null); + const [isLoading, setIsLoading] = useState(false); // const [cleanRoomData, setCleanRoomData]: any = useState(null); // const cleanRoomData = JSON.parse(sessionStorage.getItem('dataCleanRoom') || '{"cohorts": []}'); // const cohortsCount = cleanRoomData.cohorts.length; @@ -60,6 +61,7 @@ export function Nav() { }; const sendCohortsToDecentriq = async () => { + setIsLoading(true); // Replace with actual API endpoint and required request format console.log('Sending request to Decentriq', dataCleanRoom); const requestBody = dataCleanRoom; @@ -83,9 +85,11 @@ export function Nav() { const res = await response.json(); console.log(res); setPublishedDCR(res); + setIsLoading(false); // Handle response } catch (error) { console.error('Error sending cohorts:', error); + setIsLoading(false); // Handle error } }; @@ -198,6 +202,12 @@ export function Nav() { {/* TODO: {isLoading &&
} */} + {isLoading && ( +
+ +

Creating Data Clean Room in Decentriq...

+
+ )} {publishedDCR && (