web/satellite: use get user projects http endpoint

This change uses the new /projects endpoint in place of the GraphQL
MyProjects query.

Issue: https://github.com/storj/storj/issues/6132

Change-Id: Ie4ae69dd6def75c4b8c627aaf55c31914cf69ce5
This commit is contained in:
Wilfred Asomani 2023-08-02 21:46:54 +00:00 committed by Storj Robot
parent 70f6b60d91
commit e5bcb8b209

View File

@ -56,30 +56,26 @@ export class ProjectsApiGql extends BaseGql implements ProjectsApi {
* @throws Error
*/
public async get(): Promise<Project[]> {
const query = `query {
myProjects{
name
publicId
description
createdAt
memberCount
ownerId
}
}`;
const response = await this.http.get(this.ROOT_PATH);
const response = await this.query(query);
if (!response.ok) {
throw new APIError({
status: response.status,
message: 'Can not get projects',
requestID: response.headers.get('x-request-id'),
});
}
return response.data.myProjects.map((project: Project & {publicId: string}) => {
return new Project(
project.publicId,
project.name,
project.description,
project.createdAt,
project.ownerId,
false,
project.memberCount,
);
});
const projects = await response.json();
return projects.map((p: Project) => new Project(
p.id,
p.name,
p.description,
p.createdAt,
p.ownerId,
p.isSelected,
p.memberCount,
));
}
/**