import { redirect } from "next/navigation";
import { getSessionUser } from "@/lib/server/session";
import { requireActiveGroup } from "@/lib/server/groups";
import GroupSettingsContent from "@/features/groups/components/group-settings-content";

export default async function GroupSettingsPage() {
    const user = await getSessionUser();
    if (!user) redirect("/login");

    try {
        const groupId = await requireActiveGroup(user.id);
        return <GroupSettingsContent groupId={groupId} />;
    } catch {
        redirect("/");
    }
}
