added frontend + securing beta server invites
This commit is contained in:
22
web/app/dashboard/[guildId]/leveling/page.tsx
Normal file
22
web/app/dashboard/[guildId]/leveling/page.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { auth } from "@/auth";
|
||||
import { redirect, notFound } from "next/navigation";
|
||||
import { getUserGuilds } from "@/lib/discord";
|
||||
import LevelingEditor from "@/components/LevelingEditor";
|
||||
|
||||
export default async function LevelingPage({ params }: { params: Promise<{ guildId: string }> }) {
|
||||
const session = await auth();
|
||||
const { guildId } = await params;
|
||||
|
||||
if (!session?.accessToken) {
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const guilds = await getUserGuilds(session.accessToken as string);
|
||||
const currentGuild = guilds.find((g) => g.id === guildId);
|
||||
|
||||
if (!currentGuild || !currentGuild.botInGuild) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
return <LevelingEditor guildId={currentGuild.id} />;
|
||||
}
|
||||
Reference in New Issue
Block a user