host name fix

This commit is contained in:
Naveen Kumar 2025-04-22 01:05:05 +05:30
parent 6c7af3ed4b
commit 03fb97f357
8 changed files with 17 additions and 9 deletions

View File

@ -20,7 +20,8 @@ const GameList = () => {
const [upcomingMatches, setUpcomingMatches] = useState([]);
// API URL
const API_URL = 'http://localhost:5500/api';
const API_HOST = process.env.REACT_APP_API_HOST || 'localhost:5500';
const API_URL = `http://${API_HOST}/api`;
// Format time
const formatTime = (timeString) => {

View File

@ -15,7 +15,8 @@ const Home = () => {
const [currentMonth, setCurrentMonth] = useState(new Date());
// API URL
const API_URL = 'http://localhost:5500/api';
const API_HOST = process.env.REACT_APP_API_HOST || 'localhost:5500';
const API_URL = `http://${API_HOST}/api`;
// Fetch teams data
useEffect(() => {

View File

@ -19,7 +19,8 @@ const Home2 = () => {
const [upcomingMatches, setUpcomingMatches] = useState([]);
// API URL
const API_URL = 'http://localhost:5500/api';
const API_HOST = process.env.REACT_APP_API_HOST || 'localhost:5500';
const API_URL = `http://${API_HOST}/api`;
// Format time
const formatTime = (timeString) => {

View File

@ -15,7 +15,8 @@ const TeamResults = () => {
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch("http://localhost:5500/api/teams");
const API_HOST = process.env.REACT_APP_API_HOST || 'localhost:5500';
const response = await fetch(`http://${API_HOST}/api/teams`);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);

View File

@ -9,7 +9,8 @@ const MatkaResultsDashboard = () => {
const [currentDate, setCurrentDate] = useState('');
const [expandedTeams, setExpandedTeams] = useState({});
const API_URL = 'http://localhost:5500/api';
const API_HOST = process.env.REACT_APP_API_HOST || 'localhost:5500';
const API_URL = `http://${API_HOST}/api`;
const matkaTeamInfo = {
"Desawar Matka": {

View File

@ -11,7 +11,8 @@ const TodaysMatch = () => {
const [currentDate, setCurrentDate] = useState('');
// API URL (from environment variable)
const API_URL = "http://localhost:5500/api";
const API_HOST = process.env.REACT_APP_API_HOST || 'localhost:5500';
const API_URL = `http://${API_HOST}/api`;
// Format time function
const formatTime = (timeString) => {

View File

@ -10,7 +10,8 @@ const MatkaResultsDashboard = () => {
const [expandedTeams, setExpandedTeams] = useState({});
// API URL
const API_URL = 'http://localhost:5500/api';
const API_HOST = process.env.REACT_APP_API_HOST || 'localhost:5500';
const API_URL = `http://${API_HOST}/api`;
// Matka team descriptions and tips
const matkaTeamInfo = {

View File

@ -2,8 +2,9 @@
import axios from 'axios';
import { io } from 'socket.io-client';
const API_URL = 'http://localhost:3000/api';
const socket = io('http://localhost:3000');
const API_HOST = process.env.REACT_APP_API_HOST || 'localhost:3000';
const API_URL = `http://${API_HOST}/api`;
const socket = io(`http://${API_HOST}`);
export const DataService = {
// Get all teams