fix: remove duplicate tournament variable definitions in admin pages
This commit is contained in:
@@ -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 EditTournamentForm from "@/components/EditTournamentForm"
|
||||
|
||||
interface PageProps {
|
||||
@@ -12,14 +12,14 @@ interface PageProps {
|
||||
}
|
||||
|
||||
export default async function EditTournamentPage({ 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 },
|
||||
})
|
||||
|
||||
@@ -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 },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user