diff --git a/app/api/mail/route.ts b/app/api/mail/route.ts index 2c475135..ed816f44 100644 --- a/app/api/mail/route.ts +++ b/app/api/mail/route.ts @@ -67,7 +67,10 @@ export async function GET() { }); } - return NextResponse.json(result); + return NextResponse.json({ + emails: result, + folders: ['INBOX', 'Sent', 'Drafts', 'Trash', 'Spam'] + }); } finally { try { await client.logout(); diff --git a/app/mail/page.tsx b/app/mail/page.tsx index ecf13454..cc3ef694 100644 --- a/app/mail/page.tsx +++ b/app/mail/page.tsx @@ -584,7 +584,7 @@ export default function MailPage() { } // Process emails keeping exact folder names - const processedEmails = data.emails.map((email: any) => ({ + const processedEmails = (data.emails || []).map((email: any) => ({ id: Number(email.id), accountId: 1, from: email.from || '',