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({
|
return NextResponse.json({
|
||||||
url: `${nextcloudUrl}/apps/mail/box/unified`
|
emails: [], // Initialize with empty array
|
||||||
|
mailUrl: `${nextcloudUrl}/apps/mail/box/unified`
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error getting Mail URL:', error);
|
console.error('Error getting Mail URL:', error);
|
||||||
return NextResponse.json(
|
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 }
|
{ status: 404 }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ interface Email {
|
|||||||
interface EmailResponse {
|
interface EmailResponse {
|
||||||
emails: Email[];
|
emails: Email[];
|
||||||
mailUrl: string;
|
mailUrl: string;
|
||||||
|
error?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Email() {
|
export function Email() {
|
||||||
@ -56,7 +57,7 @@ export function Email() {
|
|||||||
throw new Error(data.error || 'Failed to fetch emails');
|
throw new Error(data.error || 'Failed to fetch emails');
|
||||||
}
|
}
|
||||||
|
|
||||||
setEmails(data.emails);
|
setEmails(data.emails || []);
|
||||||
setMailUrl(data.mailUrl);
|
setMailUrl(data.mailUrl);
|
||||||
setError(null);
|
setError(null);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user