fix: remove duplicate tournament variable definitions in admin pages

This commit is contained in:
2026-03-30 21:30:41 -07:00
parent e053cd7743
commit 5748e416be
2 changed files with 12 additions and 12 deletions
@@ -2,7 +2,7 @@ import { prisma } from "@/lib/prisma"
import Navigation from "@/components/Navigation"
import Link from "next/link"
import { notFound, redirect } from "next/navigation"
import { getSession } from "@/lib/auth-simple"
import { canManageTournament } from "@/lib/permissions"
import MatchEditor from "@/components/MatchEditor"
interface PageProps {
@@ -12,14 +12,14 @@ interface PageProps {
}
export default async function TournamentResultsPage({ params }: PageProps) {
const session = await getSession()
if (!session || session.user?.role !== "club_admin") {
const tournamentId = parseInt(params.id)
// Check if user can manage this tournament
const permission = await canManageTournament(tournamentId)
if (!permission.allowed) {
redirect("/auth/login")
}
const tournamentId = parseInt(params.id)
const tournament = await prisma.event.findUnique({
where: { id: tournamentId },
})