widget chat 2

This commit is contained in:
Alma 2025-04-11 11:17:23 +02:00
parent bea192f561
commit c6b677bbdc

View File

@ -9,12 +9,13 @@ export async function GET() {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
// Get the user's Rocket.Chat token from their session
const rocketChatToken = session.accessToken;
const rocketChatUserId = session.user.id;
// Use the Rocket.Chat token from environment variables
const rocketChatToken = process.env.ROCKET_CHAT_TOKEN;
const rocketChatUserId = process.env.ROCKET_CHAT_USER_ID;
if (!rocketChatToken || !rocketChatUserId) {
return NextResponse.json({ error: "No Rocket.Chat credentials found" }, { status: 401 });
console.error('Missing Rocket.Chat credentials in environment variables');
return NextResponse.json({ error: "Server configuration error" }, { status: 500 });
}
// Get the user's subscriptions (rooms they are in)