mail page imap connection mime 5 bis

This commit is contained in:
alma 2025-04-15 22:38:43 +02:00
parent cd04669609
commit fd2cec1f64

View File

@ -427,8 +427,10 @@ export default function MailPage() {
throw new Error('Failed to fetch emails');
}
const data = await response.json();
console.log('Fetched emails:', data); // Debug log
setEmails(data);
} catch (err) {
console.error('Error fetching emails:', err); // Debug log
setError(err instanceof Error ? err.message : 'An error occurred');
} finally {
setLoading(false);
@ -451,6 +453,7 @@ export default function MailPage() {
// Filter emails based on current view
const filteredEmails = emails.filter(email => {
console.log('Filtering email:', email); // Debug log
if (selectedAccount === 0) return true;
return email.accountId === selectedAccount.toString();
}).filter(email => {
@ -693,6 +696,11 @@ export default function MailPage() {
}
};
// Add useEffect to load emails on mount
useEffect(() => {
loadEmails();
}, []); // Empty dependency array means this runs once on mount
if (loading) {
return (
<div className="flex h-[calc(100vh-theme(spacing.12))] items-center justify-center bg-gray-100 mt-12">