Skip to content

Commit

Permalink
web/satellite: use project members http endpoint instead of graphql
Browse files Browse the repository at this point in the history
issue: #6137

Change-Id: I1f9b0d74fa4796c4dbee3b80618e87583b0f3f35
  • Loading branch information
cam-a authored and Storj Robot committed Aug 9, 2023
1 parent ea94bc7 commit c931234
Showing 1 changed file with 12 additions and 51 deletions.
63 changes: 12 additions & 51 deletions web/satellite/src/api/projectMembers.ts
Expand Up @@ -34,62 +34,23 @@ export class ProjectMembersApiGql extends BaseGql implements ProjectMembersApi {
}

/**
* Used for fetching team members related to project.
* Used for fetching team members and invitations related to project.
*
* @param projectId
* @param cursor for pagination
*/
public async get(projectId: string, cursor: ProjectMemberCursor): Promise<ProjectMembersPage> {
const query =
`query($projectId: String!, $limit: Int!, $search: String!, $page: Int!, $order: Int!, $orderDirection: Int!) {
project (
publicId: $projectId,
) {
membersAndInvitations (
cursor: {
limit: $limit,
search: $search,
page: $page,
order: $order,
orderDirection: $orderDirection
}
) {
projectMembers {
user {
id,
fullName,
shortName,
email
},
joinedAt
},
projectInvitations {
email,
createdAt,
expired
},
search,
limit,
order,
pageCount,
currentPage,
totalCount
}
}
}`;

const variables = {
projectId: projectId,
limit: cursor.limit,
search: cursor.search,
page: cursor.page,
order: cursor.order,
orderDirection: cursor.orderDirection,
};

const response = await this.query(query, variables);

return this.getProjectMembersList(response.data.project.membersAndInvitations);
const path = `${this.ROOT_PATH}/${projectId}/members?limit=${cursor.limit}&page=${cursor.page}&order=${cursor.page}&order-direction=${cursor.orderDirection}&search=${cursor.search}`;
const response = await this.http.get(path);
const result = await response.json();
if (!response.ok) {
throw new APIError({
status: response.status,
message: result.error || 'Failed to get project members and invitations',
requestID: response.headers.get('x-request-id'),
});
}
return this.getProjectMembersList(result);
}

/**
Expand Down

0 comments on commit c931234

Please sign in to comment.