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