Skip to content

Commit

Permalink
fix: searched comic type problem
Browse files Browse the repository at this point in the history
  • Loading branch information
lgou2w committed Apr 5, 2022
1 parent d2ea1bf commit d2cd3f0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export class PicaComicAPI {
categories?: string[]
page?: number
sort?: types.ComicSort
}): Promise<types.Comics> {
}): Promise<types.SearchedComics> {
return this.fetch
.post('comics/advanced-search', {
headers: makeAuthorizationHeaders(payload.token),
Expand All @@ -335,7 +335,7 @@ export class PicaComicAPI {
s: payload.sort || 'ua'
}
})
.json<Response<{ comics: types.Comics }>>()
.json<Response<{ comics: types.SearchedComics }>>()
.then(res => res.data.comics)
.catch(catchError)
}
Expand Down
19 changes: 19 additions & 0 deletions src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ export interface Comic {
thumb: Image
}

export interface SearchedComic {
_id: string
title: string
author?: string
totalViews: number
totalLikes: number
likesCount: number
finished: boolean
categories: string[]
thumb: Image
chineseTeam: string
description?: string
tags: string[]
updated_at: string
created_at: string
}

export interface Paginate<T> {
docs: T
total: number
Expand All @@ -63,6 +80,8 @@ export interface Paginate<T> {

export interface Comics extends Paginate<Comic[]> {}

export interface SearchedComics extends Paginate<SearchedComic[]> {}

export interface Creator {
_id: string
name: string
Expand Down

0 comments on commit d2cd3f0

Please sign in to comment.