fix: improve error handling and type safety
- Replaced 'any' types with proper TypeScript types - Improved error handling with instanceof checks - Removed unused imports (calculateExpectedTeamScore) - Updated error messages to be more descriptive - Removed deprecated eslint.config.mjs file
This commit is contained in:
@@ -66,7 +66,7 @@ export default function EditTournamentForm({ tournament }: EditTournamentFormPro
|
||||
setTimeout(() => {
|
||||
router.push(`/admin/tournaments/${tournament.id}`)
|
||||
}, 2000)
|
||||
} catch (err) {
|
||||
} catch {
|
||||
setError("An error occurred. Please try again.")
|
||||
setIsLoading(false)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ interface MatchData {
|
||||
table: string
|
||||
}
|
||||
|
||||
export default function MatchEditor({ tournamentId, players, matches }: MatchEditorProps) {
|
||||
export default function MatchEditor({ tournamentId, players }: MatchEditorProps) {
|
||||
const [formData, setFormData] = useState<MatchData>({
|
||||
team1P1Id: null,
|
||||
team1P2Id: null,
|
||||
@@ -120,7 +120,7 @@ export default function MatchEditor({ tournamentId, players, matches }: MatchEdi
|
||||
setTimeout(() => {
|
||||
window.location.reload()
|
||||
}, 1000)
|
||||
} catch (err) {
|
||||
} catch {
|
||||
setError("An error occurred. Please try again.")
|
||||
setIsLoading(false)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { createContext, useContext, useEffect, useState } from "react"
|
||||
import { authClient } from "@/lib/auth-client"
|
||||
|
||||
interface SessionContextType {
|
||||
session: { user: any; session: any } | null
|
||||
session: { user: unknown; session: unknown } | null
|
||||
loading: boolean
|
||||
refreshSession: () => Promise<void>
|
||||
}
|
||||
@@ -12,7 +12,7 @@ interface SessionContextType {
|
||||
const SessionContext = createContext<SessionContextType | undefined>(undefined)
|
||||
|
||||
export function SessionProvider({ children }: { children: React.ReactNode }) {
|
||||
const [session, setSession] = useState<{ user: any; session: any } | null>(null)
|
||||
const [session, setSession] = useState<{ user: unknown; session: unknown } | null>(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
|
||||
const refreshSession = async () => {
|
||||
|
||||
Reference in New Issue
Block a user