mail page imap connection mime 5 bis
This commit is contained in:
parent
cd04669609
commit
fd2cec1f64
@ -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">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user