diff --git a/frontend/repositories/comment/apiCommentRepository.ts b/frontend/repositories/comment/apiCommentRepository.ts index 2ac96b3b..e48a919f 100644 --- a/frontend/repositories/comment/apiCommentRepository.ts +++ b/frontend/repositories/comment/apiCommentRepository.ts @@ -16,25 +16,25 @@ export class APICommentRepository implements CommentRepository { } async list(projectId: string, exampleId: number): Promise { - const url = `/projects/${projectId}/examples/${exampleId}/comments` + const url = `/projects/${projectId}/comments?example=${exampleId}&limit=100` const response = await this.request.get(url) - return response.data.map((item: any) => plainToInstance(CommentItem, item)) + return response.data.results.map((item: any) => plainToInstance(CommentItem, item)) } async create(projectId: string, exampleId: number, text: string): Promise { - const url = `/projects/${projectId}/examples/${exampleId}/comments` + const url = `/projects/${projectId}/comments?example=${exampleId}` const response = await this.request.post(url, { projectId, exampleId, text }) return plainToInstance(CommentItem, response.data) } async update(projectId: string, exampleId: number, item: CommentItem): Promise { - const url = `/projects/${projectId}/examples/${exampleId}/comments/${item.id}` + const url = `/projects/${projectId}/comments/${item.id}` const response = await this.request.put(url, item.toObject()) return plainToInstance(CommentItem, response.data) } async delete(projectId: string, exampleId: number, commentId: number): Promise { - const url = `/projects/${projectId}/examples/${exampleId}/comments/${commentId}` + const url = `/projects/${projectId}/comments/${commentId}` const response = await this.request.delete(url) }