update widget token mail 13
This commit is contained in:
parent
24c6a65747
commit
57353f6c31
@ -2,6 +2,9 @@ import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
const ROCKET_CHAT_TOKEN = 'w91TYgkH-Z67Oz72usYdkW5TZLLRwnre7qyAhp7aHJB';
|
||||
const ROCKET_CHAT_USER_ID = 'Tpuww59PJKsrGNQJB';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const session = await getServerSession(authOptions);
|
||||
@ -61,8 +64,9 @@ export async function GET() {
|
||||
`https://parole.slm-lab.net/api/v1/users.info?username=${username}`,
|
||||
{
|
||||
headers: {
|
||||
'X-Auth-Token': process.env.ROCKET_CHAT_TOKEN!,
|
||||
'X-User-Id': process.env.ROCKET_CHAT_USER_ID!
|
||||
'X-Auth-Token': ROCKET_CHAT_TOKEN,
|
||||
'X-User-Id': ROCKET_CHAT_USER_ID,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -71,6 +75,7 @@ export async function GET() {
|
||||
console.error('Failed to get user info:', {
|
||||
status: userInfoResponse.status,
|
||||
statusText: userInfoResponse.statusText,
|
||||
headers: userInfoResponse.headers,
|
||||
response: await userInfoResponse.text().catch(() => 'Could not get response text')
|
||||
});
|
||||
return NextResponse.json(
|
||||
@ -90,8 +95,9 @@ export async function GET() {
|
||||
'https://parole.slm-lab.net/api/v1/subscriptions.get',
|
||||
{
|
||||
headers: {
|
||||
'X-Auth-Token': process.env.ROCKET_CHAT_TOKEN!,
|
||||
'X-User-Id': userInfo.user._id
|
||||
'X-Auth-Token': ROCKET_CHAT_TOKEN,
|
||||
'X-User-Id': ROCKET_CHAT_USER_ID,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -122,8 +128,9 @@ export async function GET() {
|
||||
`https://parole.slm-lab.net/api/v1/chat.getMessage?msgId=${room.lastMessage._id}`,
|
||||
{
|
||||
headers: {
|
||||
'X-Auth-Token': process.env.ROCKET_CHAT_TOKEN!,
|
||||
'X-User-Id': userInfo.user._id
|
||||
'X-Auth-Token': ROCKET_CHAT_TOKEN,
|
||||
'X-User-Id': ROCKET_CHAT_USER_ID,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user