update widget token mail 17
This commit is contained in:
parent
66b8f6bd54
commit
3d2e376927
3
.env
3
.env
@ -39,3 +39,6 @@ NEXT_PUBLIC_IFRAME_MISSIONVIEW_URL=https://connect.slm-lab.net/realms/cercle/pro
|
||||
NEXT_PUBLIC_IFRAME_USERSVIEW_URL=https://example.com/users-view
|
||||
NEXT_PUBLIC_IFRAME_THEMESSAGE_URL=https://lemessage.slm-lab.net/admin/
|
||||
NEXT_PUBLIC_IFRAME_AI_ASSISTANT_URL=https://alma.slm-lab.net
|
||||
|
||||
ROCKET_CHAT_TOKEN=w91TYgkH-Z67Oz72usYdkW5TZLLRwnre7qyAhp7aHJB
|
||||
ROCKET_CHAT_USER_ID=Tpuww59PJKsrGNQJB
|
||||
|
||||
@ -2,8 +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';
|
||||
if (!process.env.ROCKET_CHAT_TOKEN || !process.env.ROCKET_CHAT_USER_ID) {
|
||||
console.error('Missing Rocket.Chat credentials in environment variables');
|
||||
}
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
@ -64,8 +65,8 @@ export async function GET() {
|
||||
`https://parole.slm-lab.net/api/v1/users.info?username=${username}`,
|
||||
{
|
||||
headers: {
|
||||
'X-Auth-Token': ROCKET_CHAT_TOKEN,
|
||||
'X-User-Id': ROCKET_CHAT_USER_ID,
|
||||
'X-Auth-Token': process.env.ROCKET_CHAT_TOKEN!,
|
||||
'X-User-Id': process.env.ROCKET_CHAT_USER_ID!,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
@ -95,7 +96,7 @@ export async function GET() {
|
||||
'https://parole.slm-lab.net/api/v1/subscriptions.get',
|
||||
{
|
||||
headers: {
|
||||
'X-Auth-Token': ROCKET_CHAT_TOKEN,
|
||||
'X-Auth-Token': process.env.ROCKET_CHAT_TOKEN!,
|
||||
'X-User-Id': userInfo.user._id,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
@ -145,8 +146,8 @@ export async function GET() {
|
||||
`https://parole.slm-lab.net/api/v1/${endpoint}?roomId=${subscription.rid}&count=1`,
|
||||
{
|
||||
headers: {
|
||||
'X-Auth-Token': ROCKET_CHAT_TOKEN,
|
||||
'X-User-Id': ROCKET_CHAT_USER_ID,
|
||||
'X-Auth-Token': process.env.ROCKET_CHAT_TOKEN!,
|
||||
'X-User-Id': process.env.ROCKET_CHAT_USER_ID!,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import { useEffect, useState } from "react";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { RefreshCw } from "lucide-react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
interface Message {
|
||||
_id: string;
|
||||
@ -21,6 +22,7 @@ export function Parole() {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const router = useRouter();
|
||||
|
||||
const fetchMessages = async (isRefresh = false) => {
|
||||
try {
|
||||
@ -63,7 +65,10 @@ export function Parole() {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Card className="transition-transform duration-500 ease-in-out transform hover:scale-105">
|
||||
<Card
|
||||
className="transition-transform duration-500 ease-in-out transform hover:scale-105 cursor-pointer"
|
||||
onClick={() => router.push('/parole')}
|
||||
>
|
||||
<CardHeader className="flex flex-row items-center justify-between">
|
||||
<CardTitle>Parole Messages</CardTitle>
|
||||
<Button
|
||||
|
||||
Loading…
Reference in New Issue
Block a user