import logIP from "@/app/www/media/logIP";
import { getForums } from "@/app/www/logic/forums";

export const GET = logIP(
  async ({ nextUrl: { searchParams } }, { params: { forumGroup } }) => {
    const language = searchParams.get("language");

    if (!language) {
      return Response.json(undefined, { status: 400 });
    }

    return Response.json(await getForums(language, forumGroup));
  },
);
