mail page fix design dang

This commit is contained in:
alma 2025-04-21 22:19:33 +02:00
parent d0161fadae
commit 02bfb0cea8

View File

@ -686,8 +686,9 @@ export default function CourrierPage() {
// Set the selected email first to show preview immediately // Set the selected email first to show preview immediately
setSelectedEmail(email); setSelectedEmail(email);
try {
// Fetch the full email content // Fetch the full email content
const response = await fetch(`/api/mail/${emailId}`); const response = await fetch(`/api/courrier/email/${emailId}`);
if (!response.ok) { if (!response.ok) {
throw new Error('Failed to fetch full email content'); throw new Error('Failed to fetch full email content');
} }
@ -705,7 +706,7 @@ export default function CourrierPage() {
// Try to mark as read in the background // Try to mark as read in the background
try { try {
const markReadResponse = await fetch(`/api/mail/mark-read`, { const markReadResponse = await fetch(`/api/courrier/mark-read`, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -731,6 +732,11 @@ export default function CourrierPage() {
} catch (error) { } catch (error) {
console.error('Error marking email as read:', error); console.error('Error marking email as read:', error);
} }
} catch (error) {
console.error('Error fetching full email content:', error);
// If we can't fetch the full content, at least show what we have
setSelectedEmail(email);
}
}; };
// Add these improved handlers // Add these improved handlers
@ -1413,6 +1419,12 @@ export default function CourrierPage() {
const handleReply = (type: 'reply' | 'reply-all' | 'forward') => { const handleReply = (type: 'reply' | 'reply-all' | 'forward') => {
if (!selectedEmail) return; if (!selectedEmail) return;
// Ensure we have the email content
if (!selectedEmail.body) {
console.error('No email content available for reply/forward');
return;
}
const getReplyTo = () => { const getReplyTo = () => {
if (type === 'forward') return ''; if (type === 'forward') return '';
return selectedEmail.from; return selectedEmail.from;