mail page fix
This commit is contained in:
parent
ad0edb8fc2
commit
dbe55757be
@ -527,7 +527,7 @@ export default function CourrierPage() {
|
|||||||
}
|
}
|
||||||
setError(null);
|
setError(null);
|
||||||
|
|
||||||
const response = await fetch('/api/mail');
|
const response = await fetch(`/api/courrier?folder=${encodeURIComponent(currentView)}&page=${page}&limit=${emailsPerPage}`);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('Failed to load emails');
|
throw new Error('Failed to load emails');
|
||||||
}
|
}
|
||||||
@ -544,14 +544,14 @@ export default function CourrierPage() {
|
|||||||
id: Number(email.id),
|
id: Number(email.id),
|
||||||
accountId: 1,
|
accountId: 1,
|
||||||
from: email.from || '',
|
from: email.from || '',
|
||||||
fromName: email.from?.split('@')[0] || '',
|
fromName: email.fromName || email.from?.split('@')[0] || '',
|
||||||
to: email.to || '',
|
to: email.to || '',
|
||||||
subject: email.subject || '(No subject)',
|
subject: email.subject || '(No subject)',
|
||||||
body: email.body || '',
|
body: email.body || '',
|
||||||
date: email.date || new Date().toISOString(),
|
date: email.date || new Date().toISOString(),
|
||||||
read: email.read || false,
|
read: email.read || false,
|
||||||
starred: email.starred || false,
|
starred: email.starred || false,
|
||||||
folder: email.folder || 'INBOX',
|
folder: email.folder || currentView,
|
||||||
cc: email.cc,
|
cc: email.cc,
|
||||||
bcc: email.bcc,
|
bcc: email.bcc,
|
||||||
flags: email.flags || []
|
flags: email.flags || []
|
||||||
@ -572,6 +572,9 @@ export default function CourrierPage() {
|
|||||||
setEmails(processedEmails);
|
setEmails(processedEmails);
|
||||||
setPage(1);
|
setPage(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update hasMore based on API response
|
||||||
|
setHasMore(data.hasMore || false);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err instanceof Error ? err.message : 'Failed to load emails');
|
setError(err instanceof Error ? err.message : 'Failed to load emails');
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user