compose mime
This commit is contained in:
parent
079f876674
commit
c05c4e71ca
@ -507,8 +507,9 @@ export default function CourrierPage() {
|
|||||||
setAvailableFolders(data.folders);
|
setAvailableFolders(data.folders);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process emails keeping exact folder names
|
// Process emails keeping exact folder names and sort by date
|
||||||
const processedEmails = (data.emails || []).map((email: any) => ({
|
const processedEmails = (data.emails || [])
|
||||||
|
.map((email: any) => ({
|
||||||
id: Number(email.id),
|
id: Number(email.id),
|
||||||
accountId: 1,
|
accountId: 1,
|
||||||
from: email.from || '',
|
from: email.from || '',
|
||||||
@ -524,7 +525,8 @@ export default function CourrierPage() {
|
|||||||
bcc: email.bcc,
|
bcc: email.bcc,
|
||||||
flags: email.flags || [],
|
flags: email.flags || [],
|
||||||
raw: email.body || ''
|
raw: email.body || ''
|
||||||
}));
|
}))
|
||||||
|
.sort((a: Email, b: Email) => new Date(b.date).getTime() - new Date(a.date).getTime());
|
||||||
|
|
||||||
// Only update unread count if we're in the Inbox folder
|
// Only update unread count if we're in the Inbox folder
|
||||||
if (currentView === 'INBOX') {
|
if (currentView === 'INBOX') {
|
||||||
@ -535,7 +537,9 @@ export default function CourrierPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isLoadMore) {
|
if (isLoadMore) {
|
||||||
setEmails(prev => [...prev, ...processedEmails]);
|
setEmails(prev => [...prev, ...processedEmails].sort((a: Email, b: Email) =>
|
||||||
|
new Date(b.date).getTime() - new Date(a.date).getTime()
|
||||||
|
));
|
||||||
setPage(prev => prev + 1);
|
setPage(prev => prev + 1);
|
||||||
} else {
|
} else {
|
||||||
setEmails(processedEmails);
|
setEmails(processedEmails);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user