widget email 5
This commit is contained in:
parent
30f30cb569
commit
582c69a96d
@ -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`, {
|
const userInfoResponse = await fetch(`${nextcloudUrl}/ocs/v2.php/cloud/user`, {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Bearer ${session.accessToken}`,
|
'Authorization': `Bearer ${session.accessToken}`,
|
||||||
@ -57,11 +57,11 @@ export async function GET(req: NextRequest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now try to access the Mail app
|
// 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: {
|
headers: {
|
||||||
'Authorization': `Bearer ${session.accessToken}`,
|
'Authorization': `Bearer ${session.accessToken}`,
|
||||||
'Accept': 'application/json',
|
'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
|
// For now, return a success response with an empty array
|
||||||
// We'll implement the actual message fetching once we confirm the correct endpoint
|
// We'll implement the actual message fetching once we confirm the correct endpoint
|
||||||
return NextResponse.json([]);
|
return NextResponse.json([]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user