Browse Source

Fix the url of comment repository

pull/1649/head
Hironsan 3 years ago
parent
commit
50b70fdd12
1 changed files with 5 additions and 5 deletions
  1. 10
      frontend/repositories/comment/apiCommentRepository.ts

10
frontend/repositories/comment/apiCommentRepository.ts

@ -16,25 +16,25 @@ export class APICommentRepository implements CommentRepository {
}
async list(projectId: string, exampleId: number): Promise<CommentItem[]> {
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<CommentItem> {
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<CommentItem> {
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<void> {
const url = `/projects/${projectId}/examples/${exampleId}/comments/${commentId}`
const url = `/projects/${projectId}/comments/${commentId}`
const response = await this.request.delete(url)
}

Loading…
Cancel
Save