Skip to content

Commit

Permalink
fixing fetching invitation for specific organization (#515)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ndevu12 authored Oct 3, 2024
1 parent 4c34ae8 commit 36bc829
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 12 additions & 3 deletions src/pages/invitation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,15 @@ function Invitation() {

useEffect(() => {
if (filterVariables.role || filterVariables.status) {
filterInvitations();
filterInvitations({
variables: {
role: filterVariables.role || null,
status: typeof filterVariables.status === 'string' ? filterVariables.status : null,
orgToken: organizationToken,
},
});
}
}, [filterVariables, filterInvitations]);
}, [filterVariables, filterInvitations,organizationToken]);

// Consolidated effect to handle query and search data
useEffect(() => {
Expand Down Expand Up @@ -278,7 +284,10 @@ function Invitation() {
setError(null);
setLoading(false);

setFilterVariables({ role: selectedRole, status: selectedStatus });
setFilterVariables({
role: selectedRole,
status: typeof selectedStatus === 'string' ? selectedStatus : '',
});
};

const toggleOptions = (row: string) => {
Expand Down
4 changes: 2 additions & 2 deletions src/queries/invitation.queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export const GET_INVITATIONS = gql`
`;

export const GET_ROLES_AND_STATUSES = gql`
query filterInvitations($limit: Int, $offset: Int, $role: String, $status: String) {
filterInvitations(limit: $limit, offset: $offset, role: $role, status: $status) {
query filterInvitations($limit: Int, $offset: Int, $role: String, $status: String, $orgToken: String!) {
filterInvitations(limit: $limit, offset: $offset, role: $role, status: $status, orgToken: $orgToken) {
invitations {
invitees {
email
Expand Down

0 comments on commit 36bc829

Please sign in to comment.