22 lines
549 B
TypeScript
22 lines
549 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { TeamsService } from "@/services";
|
|
|
|
interface RouteParams {
|
|
params: {
|
|
direction: string;
|
|
};
|
|
}
|
|
|
|
export async function GET(request: Request, { params }: RouteParams) {
|
|
try {
|
|
const teams = await TeamsService.getTeamsByDirection(params.direction);
|
|
return NextResponse.json(teams);
|
|
} catch (error) {
|
|
console.error("Error loading teams by direction:", error);
|
|
return NextResponse.json(
|
|
{ error: "Failed to load teams by direction" },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|