Fondation
This commit is contained in:
parent
a0b11c7b5f
commit
2cfcc60b65
@ -23,15 +23,16 @@ const CACHE_TTL = 60 * 1000;
|
|||||||
const emailListCache: Record<string, EmailCacheEntry> = {};
|
const emailListCache: Record<string, EmailCacheEntry> = {};
|
||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
|
// Authenticate user (declare outside try to access in catch)
|
||||||
|
const session = await getServerSession(authOptions);
|
||||||
|
if (!session || !session.user?.id) {
|
||||||
|
return NextResponse.json(
|
||||||
|
{ error: "Not authenticated" },
|
||||||
|
{ status: 401 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Authenticate user
|
|
||||||
const session = await getServerSession(authOptions);
|
|
||||||
if (!session || !session.user?.id) {
|
|
||||||
return NextResponse.json(
|
|
||||||
{ error: "Not authenticated" },
|
|
||||||
{ status: 401 }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract query parameters
|
// Extract query parameters
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user