25 lines
720 B
TypeScript
25 lines
720 B
TypeScript
import { getServerSession } from "next-auth";
|
|
import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
|
import { getDiscordMemberProfile } from "@/app/actions/discord";
|
|
import { AdminShell } from "@/components/admin-shell";
|
|
|
|
export async function AdminShellServer({ children }: { children: React.ReactNode }) {
|
|
const session = await getServerSession(authOptions);
|
|
const discordId = (session?.user as any)?.discordId;
|
|
let profile = null;
|
|
|
|
if (discordId) {
|
|
profile = await getDiscordMemberProfile(discordId);
|
|
}
|
|
|
|
return (
|
|
<AdminShell
|
|
userName={session?.user?.name ?? ""}
|
|
userImage={session?.user?.image ?? ""}
|
|
profile={profile}
|
|
>
|
|
{children}
|
|
</AdminShell>
|
|
);
|
|
}
|