Request URL: http://localhost:3000/leagues/EC Request Method: GET Status Code: 404 Not…
- User
Request URL: http://localhost:3000/leagues/EC Request Method: GET Status Code: 404 Not Found Remote Address: [::1]:3000 Referrer Policy: strict-origin-when-cross-origin cache-control: no-store, must-revalidate connection: keep-alive content-encoding: gzip content-type: text/html; charset=utf-8 date: Wed, 25 Sep 2024 09:05:28 GMT keep-alive: timeout=5 transfer-encoding: chunked vary: RSC, Next-Router-State-Tree, Next-Router-Prefetch, Accept-Encoding x-powered-by: Next.js accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7 accept-encoding: gzip, deflate, br, zstd accept-language: en-US,en;q=0.9,en-IN;q=0.8 cache-control: max-age=0 connection: keep-alive dnt: 1 host: localhost:3000 referer: http://localhost:3000/ sec-ch-ua: "Chromium";v="128", "Not;A=Brand";v="24", "Microsoft Edge";v="128" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" sec-fetch-dest: document sec-fetch-mode: navigate sec-fetch-site: same-origin sec-fetch-user: ?1 upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0 // pages/leagues/[code].tsx
import { useRouter } from 'next/router'; import { useEffect, useState } from 'react'; import { Card, CardContent, CardHeader, CardTitle, } from "@/components/ui/card"; import { Table } from "@/components/ui/table"; import axios from 'axios';
interface LeagueInfo { id: number; name: string; area: { id: number; name: string; code: string; flag: string; }; code: string; type: string; emblem: string; currentSeason: { id: number; startDate: string; endDate: string; currentMatchday: number; winner: any; stages: string[]; }; lastUpdated: string; }
interface Team { id: number; name: string; shortName: string; tla: string; crest: string; venue: string; website: string; founded: number; clubColors: string; }
interface LeagueData { league: LeagueInfo; teams: Team[]; }
export default function LeagueDetail() { const router = useRouter(); const { code } = router.query; const [leagueData, setLeagueData] = useState<LeagueData | null>(null); const [loading, setLoading] = useState(true); const [error, setError] = useState<string | null>(null);
// Retrieve backend URL from environment variables const backendUrl = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://localhost:5000';
useEffect(() => { if (!code) return;
code - Assistant
The error you are encountering is due to the backend server not being properly set up or not available at the specified URL. You are attempting to access a resource at , and the server is returning a 404 Not Found status code. This indicates that the endpoint you are trying to access does not exist or the path is incorrect.