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([]); const [upcomingMatches, setUpcomingMatches] = useState([]);
// API URL // 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 // Format time
const formatTime = (timeString) => { const formatTime = (timeString) => {

View File

@ -15,7 +15,8 @@ const Home = () => {
const [currentMonth, setCurrentMonth] = useState(new Date()); const [currentMonth, setCurrentMonth] = useState(new Date());
// API URL // 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 // Fetch teams data
useEffect(() => { useEffect(() => {

View File

@ -19,7 +19,8 @@ const Home2 = () => {
const [upcomingMatches, setUpcomingMatches] = useState([]); const [upcomingMatches, setUpcomingMatches] = useState([]);
// API URL // 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 // Format time
const formatTime = (timeString) => { const formatTime = (timeString) => {

View File

@ -15,7 +15,8 @@ const TeamResults = () => {
useEffect(() => { useEffect(() => {
const fetchData = async () => { const fetchData = async () => {
try { 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) { if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`); throw new Error(`HTTP error! Status: ${response.status}`);

View File

@ -9,7 +9,8 @@ const MatkaResultsDashboard = () => {
const [currentDate, setCurrentDate] = useState(''); const [currentDate, setCurrentDate] = useState('');
const [expandedTeams, setExpandedTeams] = 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 = { const matkaTeamInfo = {
"Desawar Matka": { "Desawar Matka": {

View File

@ -11,7 +11,8 @@ const TodaysMatch = () => {
const [currentDate, setCurrentDate] = useState(''); const [currentDate, setCurrentDate] = useState('');
// API URL (from environment variable) // 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 // Format time function
const formatTime = (timeString) => { const formatTime = (timeString) => {

View File

@ -10,7 +10,8 @@ const MatkaResultsDashboard = () => {
const [expandedTeams, setExpandedTeams] = useState({}); const [expandedTeams, setExpandedTeams] = useState({});
// API URL // 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 // Matka team descriptions and tips
const matkaTeamInfo = { const matkaTeamInfo = {

View File

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