courrier multi account restore compose
This commit is contained in:
parent
3cb423a9e2
commit
814d63f434
@ -270,7 +270,7 @@ export async function getEmails(
|
|||||||
page: number = 1,
|
page: number = 1,
|
||||||
perPage: number = 20,
|
perPage: number = 20,
|
||||||
accountId?: string
|
accountId?: string
|
||||||
): Promise<EmailMessage[]> {
|
): Promise<EmailListResult> {
|
||||||
try {
|
try {
|
||||||
// Extract the base folder name by removing the accountId suffix if present
|
// Extract the base folder name by removing the accountId suffix if present
|
||||||
const baseFolder = accountId && folder.includes(`-${accountId}`)
|
const baseFolder = accountId && folder.includes(`-${accountId}`)
|
||||||
@ -340,7 +340,18 @@ export async function getEmails(
|
|||||||
await cacheEmailList(userId, accountId, folder, page, perPage, emails);
|
await cacheEmailList(userId, accountId, folder, page, perPage, emails);
|
||||||
}
|
}
|
||||||
|
|
||||||
return emails;
|
// Get mailboxes for this account
|
||||||
|
const mailboxes = await getMailboxes(imap, accountId);
|
||||||
|
|
||||||
|
return {
|
||||||
|
emails,
|
||||||
|
totalEmails: total,
|
||||||
|
page,
|
||||||
|
perPage,
|
||||||
|
totalPages: Math.ceil(total / perPage),
|
||||||
|
folder,
|
||||||
|
mailboxes
|
||||||
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error fetching emails for folder ${folder}:`, error);
|
console.error(`Error fetching emails for folder ${folder}:`, error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user