widget email 15
This commit is contained in:
parent
ef5c38a42e
commit
f55bba3c1b
@ -19,14 +19,18 @@ export async function GET(req: NextRequest) {
|
||||
);
|
||||
}
|
||||
|
||||
// Return the Nextcloud Mail iframe URL
|
||||
// Return the Nextcloud Mail iframe URL with an empty emails array
|
||||
return NextResponse.json({
|
||||
url: `${nextcloudUrl}/apps/mail/box/unified`
|
||||
emails: [], // Initialize with empty array
|
||||
mailUrl: `${nextcloudUrl}/apps/mail/box/unified`
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error getting Mail URL:', error);
|
||||
return NextResponse.json(
|
||||
{ error: "L'application Mail n'est pas disponible sur Nextcloud. Veuillez contacter votre administrateur." },
|
||||
{
|
||||
error: "L'application Mail n'est pas disponible sur Nextcloud. Veuillez contacter votre administrateur.",
|
||||
emails: [] // Initialize with empty array even in error case
|
||||
},
|
||||
{ status: 404 }
|
||||
);
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ interface Email {
|
||||
interface EmailResponse {
|
||||
emails: Email[];
|
||||
mailUrl: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export function Email() {
|
||||
@ -56,7 +57,7 @@ export function Email() {
|
||||
throw new Error(data.error || 'Failed to fetch emails');
|
||||
}
|
||||
|
||||
setEmails(data.emails);
|
||||
setEmails(data.emails || []);
|
||||
setMailUrl(data.mailUrl);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user