web/satellite: use project members http endpoint instead of graphql
issue: https://github.com/storj/storj/issues/6137 Change-Id: I1f9b0d74fa4796c4dbee3b80618e87583b0f3f35
This commit is contained in:
parent
ea94bc7f6d
commit
c931234e46
@ -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 projectId
|
||||||
* @param cursor for pagination
|
* @param cursor for pagination
|
||||||
*/
|
*/
|
||||||
public async get(projectId: string, cursor: ProjectMemberCursor): Promise<ProjectMembersPage> {
|
public async get(projectId: string, cursor: ProjectMemberCursor): Promise<ProjectMembersPage> {
|
||||||
const query =
|
const path = `${this.ROOT_PATH}/${projectId}/members?limit=${cursor.limit}&page=${cursor.page}&order=${cursor.page}&order-direction=${cursor.orderDirection}&search=${cursor.search}`;
|
||||||
`query($projectId: String!, $limit: Int!, $search: String!, $page: Int!, $order: Int!, $orderDirection: Int!) {
|
const response = await this.http.get(path);
|
||||||
project (
|
const result = await response.json();
|
||||||
publicId: $projectId,
|
if (!response.ok) {
|
||||||
) {
|
throw new APIError({
|
||||||
membersAndInvitations (
|
status: response.status,
|
||||||
cursor: {
|
message: result.error || 'Failed to get project members and invitations',
|
||||||
limit: $limit,
|
requestID: response.headers.get('x-request-id'),
|
||||||
search: $search,
|
});
|
||||||
page: $page,
|
|
||||||
order: $order,
|
|
||||||
orderDirection: $orderDirection
|
|
||||||
}
|
}
|
||||||
) {
|
return this.getProjectMembersList(result);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user