import { useCallback, useEffect, useState } from 'react'; import { Navigate } from 'react-router-dom'; import { useGQLClient } from '../context/GQLClientContext'; import { Organization } from 'gql-client'; const Index = () => { const client = useGQLClient(); const [organization, setOrganization] = useState(); const fetchUserOrganizations = useCallback(async () => { const { organizations } = await client.getOrganizations(); // By default information of first organization displayed setOrganization(organizations[0]); }, []); useEffect(() => { fetchUserOrganizations(); }, []); return ( <> {Boolean(organization) ? ( ) : ( <>Loading )} ); }; export default Index;