File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -246,9 +246,10 @@ export class JikeClient extends EventEmitter<EventMap> {
246246 (
247247 update
248248 ) : ( { actionTime : string } & PersonalUpdate ) | JikePostWithDetail => {
249- // TODO repost
250249 if ( update . type === 'ORIGINAL_POST' ) {
251250 return this . getPost ( PostType . ORIGINAL , update . id , update )
251+ } else if ( update . type === 'REPOST' ) {
252+ return this . getPost ( PostType . REPOST , update . id , update )
252253 } else {
253254 return update
254255 }
Original file line number Diff line number Diff line change 1- import { PostType } from '../types/options'
21import { isSuccess , throwRequestFailureError } from './utils/response'
32import { fetchPaginated } from './utils/paginate'
3+ import { rawTypeToEnum } from './utils/post'
44import type { UserUnfollowOption } from '../types/options'
55import type { PersonalPost , User } from '../types/entity'
66import type { Users } from '../types/api-responses'
@@ -97,10 +97,9 @@ export class JikeUser<M extends boolean = boolean> {
9797 option
9898 )
9999
100- return updates . map ( ( update ) => {
101- // TODO: repost
102- return this . #client. getPost ( PostType . ORIGINAL , update . id , update )
103- } )
100+ return updates . map ( ( update ) =>
101+ this . #client. getPost ( rawTypeToEnum ( update . type ) , update . id , update )
102+ )
104103 }
105104
106105 /**
Original file line number Diff line number Diff line change @@ -82,8 +82,16 @@ export interface OriginalPost {
8282 liked ?: boolean
8383}
8484
85+ /**
86+ * 转帖
87+ */
88+ export interface Repost {
89+ type : 'REPOST'
90+ [ key : string ] : any
91+ }
92+
8593/** 动态 */
86- export type Post = OriginalPost /* | Repost */
94+ export type Post = OriginalPost | Repost
8795
8896/** 主页动态 */
8997export type PersonalPost = {
You can’t perform that action at this time.
0 commit comments