added frontend + securing beta server invites

This commit is contained in:
2026-01-02 22:50:02 +05:30
parent cb12b8ef75
commit 9b17a99456
52 changed files with 5409 additions and 5 deletions

View File

@@ -0,0 +1,27 @@
import { auth } from "@/auth";
import { NextRequest, NextResponse } from "next/server";
import { getGuildRoles } from "@/lib/discord";
// GET - Fetch all roles for a guild
export async function GET(
request: NextRequest,
{ params }: { params: Promise<{ guildId: string }> }
) {
const session = await auth();
const { guildId } = await params;
if (!session?.accessToken) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
try {
const roles = await getGuildRoles(guildId, session.accessToken as string);
return NextResponse.json(roles);
} catch (error) {
console.error("Error fetching roles:", error);
return NextResponse.json(
{ error: "Internal server error" },
{ status: 500 }
);
}
}