Neah version mail remove mail correction 4
This commit is contained in:
parent
542280b65b
commit
61d4f19875
@ -1550,9 +1550,17 @@ export default function MailPage() {
|
||||
}
|
||||
const data = await response.json();
|
||||
setEmails(data.emails);
|
||||
// Only update unread count if we're in the Inbox
|
||||
|
||||
// Only update unread count when switching to Inbox
|
||||
if (newMailbox === 'INBOX') {
|
||||
setUnreadCount(data.unreadCount);
|
||||
} else {
|
||||
// Keep the existing unread count when switching to other folders
|
||||
const inboxResponse = await fetch('/api/mail?folder=INBOX');
|
||||
if (inboxResponse.ok) {
|
||||
const inboxData = await inboxResponse.json();
|
||||
setUnreadCount(inboxData.unreadCount);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to fetch emails');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user