widget email 5

This commit is contained in:
Alma 2025-04-13 21:00:12 +02:00
parent 30f30cb569
commit 582c69a96d

View File

@ -19,7 +19,7 @@ export async function GET(req: NextRequest) {
);
}
// First, try to get the user's Nextcloud ID using the OIDC token
// First, try to get the user's Nextcloud ID using the Keycloak token
const userInfoResponse = await fetch(`${nextcloudUrl}/ocs/v2.php/cloud/user`, {
headers: {
'Authorization': `Bearer ${session.accessToken}`,
@ -57,11 +57,11 @@ export async function GET(req: NextRequest) {
}
// Now try to access the Mail app
const response = await fetch(`${nextcloudUrl}/ocs/v2.php/apps/mail/api/v1/accounts`, {
const response = await fetch(`${nextcloudUrl}/index.php/apps/mail/api/accounts`, {
headers: {
'Authorization': `Bearer ${session.accessToken}`,
'Accept': 'application/json',
'OCS-APIRequest': 'true',
'Content-Type': 'application/json',
},
});
@ -82,7 +82,8 @@ export async function GET(req: NextRequest) {
);
}
// If we get here, the Mail app is available
const accounts = await response.json();
// For now, return a success response with an empty array
// We'll implement the actual message fetching once we confirm the correct endpoint
return NextResponse.json([]);