Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get books in archive #2

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion source/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,20 @@ export interface BookProgress {
export interface MemberCardSummary {}

export interface Shelf2 {
archive: Archive[];
books: Book2[];
bookProgress: BookProgress[];
balanceIOS: number;
balanceAndroid: number;
memberCardSummary: MemberCardSummary;
}

export interface Archive {
archiveId: string;
name: string;
bookIds: string[];
}

export interface RootObject {
platform: string;
deviceInfo: string;
Expand Down Expand Up @@ -237,7 +244,9 @@ export const SyncAllData = async ({
}): Promise<void> => {
setStage('Try to get all infos from weread');
const value = await getAllInfos();
const bookIds = value.shelf.books.map((book) => book.bookId);
const bookIds = value.shelf.books
.map((book) => book.bookId)
.concat(value.shelf.archive.map((archive) => archive.bookIds).flat());
setBookCount(bookIds.length);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let allHighlights: any[] = [];
Expand Down