From 2dba57191b2880dc8229e202ddec3b01890fcf32 Mon Sep 17 00:00:00 2001 From: Deep Koluguri Date: Mon, 22 Jun 2026 19:43:18 -0400 Subject: [PATCH] fix: change hardcoded localhost URLs to relative URLs so frontend works on production domain --- frontend/src/components/dashboard/MarketScreenerPanel.jsx | 2 +- frontend/src/components/dashboard/NewsFeedPanel.jsx | 2 +- frontend/src/components/dashboard/StockDetailPanel.jsx | 2 +- frontend/src/config/api.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/dashboard/MarketScreenerPanel.jsx b/frontend/src/components/dashboard/MarketScreenerPanel.jsx index ad3b56a..29ea36d 100644 --- a/frontend/src/components/dashboard/MarketScreenerPanel.jsx +++ b/frontend/src/components/dashboard/MarketScreenerPanel.jsx @@ -1,6 +1,6 @@ import { useState, useEffect, useCallback } from 'react'; -const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:3010'; +const API_BASE = import.meta.env.VITE_API_URL || ''; const CAP_TABS = [ { id: 'all', label: '🌐 All', color: 'text-slate-300' }, diff --git a/frontend/src/components/dashboard/NewsFeedPanel.jsx b/frontend/src/components/dashboard/NewsFeedPanel.jsx index 8c0e1c6..0cdbaeb 100644 --- a/frontend/src/components/dashboard/NewsFeedPanel.jsx +++ b/frontend/src/components/dashboard/NewsFeedPanel.jsx @@ -1,6 +1,6 @@ import { useState, useEffect } from 'react'; -const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:3010'; +const API_BASE = import.meta.env.VITE_API_URL || ''; function SentimentDot({ sentiment }) { if (sentiment === 'BULLISH') return ; diff --git a/frontend/src/components/dashboard/StockDetailPanel.jsx b/frontend/src/components/dashboard/StockDetailPanel.jsx index dfad87d..4f04c03 100644 --- a/frontend/src/components/dashboard/StockDetailPanel.jsx +++ b/frontend/src/components/dashboard/StockDetailPanel.jsx @@ -1,6 +1,6 @@ import { useState, useEffect } from 'react'; -const API_BASE = import.meta.env.VITE_API_URL || 'http://localhost:3010'; +const API_BASE = import.meta.env.VITE_API_URL || ''; function fmt(n, decimals = 2, prefix = '') { if (n == null || isNaN(n)) return '—'; diff --git a/frontend/src/config/api.js b/frontend/src/config/api.js index d8dd5e5..2497ba2 100644 --- a/frontend/src/config/api.js +++ b/frontend/src/config/api.js @@ -4,8 +4,8 @@ */ export const API_CONFIG = { - baseUrl: import.meta.env.VITE_API_URL || 'http://localhost:3010', - wsUrl: import.meta.env.VITE_WS_URL || 'ws://localhost:5010', + baseUrl: import.meta.env.VITE_API_URL || '', + wsUrl: import.meta.env.VITE_WS_URL || (typeof window !== 'undefined' ? (window.location.protocol === 'https:' ? 'wss:' : 'ws:') + '//' + window.location.host : ''), timeout: parseInt(import.meta.env.VITE_API_TIMEOUT || '30000'), retryAttempts: parseInt(import.meta.env.VITE_API_RETRY_ATTEMPTS || '3'), retryDelay: parseInt(import.meta.env.VITE_API_RETRY_DELAY || '1000')