diff --git a/src/GraphQl/Queries/Queries.ts b/src/GraphQl/Queries/Queries.ts index c3999ba00e..c3735e241f 100644 --- a/src/GraphQl/Queries/Queries.ts +++ b/src/GraphQl/Queries/Queries.ts @@ -335,6 +335,62 @@ export const EVENT_FEEDBACKS = gql` } `; +// Query to take the Organization with data by creatorId +export const ORGANIZATIONS_LIST_BY_CREATOR_ID = gql` + query OrganizationsByCreator($creatorId: ID!) { + organizations(where: { creatorId: $creatorId }) { + _id + image + creator { + firstName + lastName + email + } + name + description + address { + city + countryCode + dependentLocality + line1 + line2 + postalCode + sortingCode + state + } + userRegistrationRequired + visibleInSearch + members { + _id + firstName + lastName + email + } + admins { + _id + firstName + lastName + email + createdAt + } + membershipRequests { + _id + user { + firstName + lastName + email + } + } + blockedUsers { + _id + firstName + lastName + email + } + } + } +`; + // Query to take the Organization with data export const ORGANIZATIONS_LIST = gql` query Organizations($id: ID!) { diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx index e9495187ee..e14feb9cf0 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx @@ -1,6 +1,6 @@ import { useQuery } from '@apollo/client'; import { WarningAmberOutlined } from '@mui/icons-material'; -import { ORGANIZATIONS_LIST } from 'GraphQl/Queries/Queries'; +import { ORGANIZATIONS_LIST_BY_CREATOR_ID } from 'GraphQl/Queries/Queries'; import CollapsibleDropdown from 'components/CollapsibleDropdown/CollapsibleDropdown'; import IconComponent from 'components/IconComponent/IconComponent'; import React, { useEffect, useState } from 'react'; @@ -49,8 +49,8 @@ const leftDrawerOrg = ({ | { organizations: InterfaceQueryOrganizationsListObject[] } | undefined; loading: boolean; - } = useQuery(ORGANIZATIONS_LIST, { - variables: { id: orgId }, + } = useQuery(ORGANIZATIONS_LIST_BY_CREATOR_ID, { + variables: { creatorId: orgId }, }); // Set organization data when query data is available