fix: export all should load all of chats

closes #86
This commit is contained in:
Pionxzh
2023-03-25 01:53:59 +08:00
parent 792df8d320
commit 770f129981
+2 -2
View File
@@ -108,12 +108,12 @@ export async function fetchConversations(offset = 0, limit = 20): Promise<ApiCon
export async function fetchAllConversations(): Promise<ApiConversationItem[]> {
const conversations: ApiConversationItem[] = []
let offset = 0
const limit = 20
let offset = 0
while (true) {
const result = await fetchConversations(offset, limit)
conversations.push(...result.items)
if (result.items.length < limit) break
if (offset + limit >= result.total) break
offset += limit
}
return conversations