33 lines
849 B
TypeScript
33 lines
849 B
TypeScript
import { getServerSession } from "next-auth";
|
|
import { authOptions } from "@/lib/auth/auth-options";
|
|
import { getSessionDiscordId } from "@/lib/auth/auth";
|
|
import { getDiscordMemberProfile } from "@/lib/discord/discord";
|
|
import { AdminShell } from "@/components/admin-shell";
|
|
|
|
export async function AdminShellServer({
|
|
children,
|
|
healthStatus,
|
|
}: {
|
|
children: React.ReactNode;
|
|
healthStatus?: React.ReactNode;
|
|
}) {
|
|
const session = await getServerSession(authOptions);
|
|
const discordId = getSessionDiscordId(session);
|
|
let profile = null;
|
|
|
|
if (discordId) {
|
|
profile = await getDiscordMemberProfile(discordId);
|
|
}
|
|
|
|
return (
|
|
<AdminShell
|
|
userName={session?.user?.name ?? ""}
|
|
userImage={session?.user?.image ?? ""}
|
|
profile={profile}
|
|
healthStatus={healthStatus}
|
|
>
|
|
{children}
|
|
</AdminShell>
|
|
);
|
|
}
|