Skip to content

Commit 3d7cba9

Browse files
committed
feat(api): add remove comment
1 parent ea556f5 commit 3d7cba9

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
- [x] [发送评论](http://jike-sdk.sxzz.moe/functions/api_comments.add.html)
5656
- [x] [点赞](http://jike-sdk.sxzz.moe/functions/api_comments.like.html)
5757
- [x] [取消点赞](http://jike-sdk.sxzz.moe/functions/api_comments.unlike.html)
58+
- [x] [删除评论](http://jike-sdk.sxzz.moe/functions/api_comments.remove.html)
5859
- [动态](http://jike-sdk.sxzz.moe/modules/api_personal_update.html)
5960
- [x] [获取用户动态](http://jike-sdk.sxzz.moe/functions/api_personal_update.single.html)
6061
- [x] [获取关注动态](http://jike-sdk.sxzz.moe/functions/api_personal_update.followingUpdates.html)

src/api/comments.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ export const unlike = <T = {}>(targetType: PostTypeRaw, id: string) =>
3838
})
3939
)
4040

41+
export const remove = <T = Comments.RemoveResponse>(
42+
targetType: PostTypeRaw,
43+
id: string
44+
) =>
45+
toResponse<T>(
46+
request.post('1.0/comments/remove', {
47+
json: { targetType, id },
48+
})
49+
)
50+
4151
export const listPrimary = <T = Comments.ListPrimaryResponse>(
4252
targetType: PostTypeRaw,
4353
targetId: string,

src/types/api-responses.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ export namespace Comments {
190190
toast: string
191191
}
192192

193+
export interface RemoveResponse {
194+
toast: LiteralUnion<'已删除'>
195+
}
196+
193197
export interface ListPrimaryResponse {
194198
data: Comment[]
195199
loadMoreKey?: {

0 commit comments

Comments
 (0)