Sasha commited on
Commit
c488ea7
·
1 Parent(s): 083990e

fix: use fully qualified API_BASE for avatar proxy requests

Browse files
Files changed (1) hide show
  1. client/src/App.jsx +5 -5
client/src/App.jsx CHANGED
@@ -44,6 +44,10 @@ ChartJS.register(
44
  Filler
45
  );
46
 
 
 
 
 
47
  // 3D Galaxy Chatter Orbit Visualization
48
  function ChatterOrbit({ chatters }) {
49
  const canvasRef = useRef(null);
@@ -55,7 +59,7 @@ function ChatterOrbit({ chatters }) {
55
  // Load Avatar via backend proxy (avoids CORS issues with decapi.me)
56
  if (!avatarRef.current) {
57
  const img = new Image();
58
- img.src = '/api/avatar/winx_prinx';
59
  img.onload = () => { avatarRef.current = img; };
60
  img.onerror = () => console.warn('[ChatterOrbit] Avatar load failed');
61
  }
@@ -278,10 +282,6 @@ function ChatterOrbit({ chatters }) {
278
  );
279
  }
280
 
281
- // Fallback to local port 3000 in development, or use VITE_API_URL if configured, otherwise same origin
282
- const API_BASE = import.meta.env.VITE_API_URL || (import.meta.env.DEV ? 'http://localhost:3000' : '');
283
- const TWITCH_CHANNEL = 'winx_prinx';
284
-
285
  export default function App() {
286
  const [activeTab, setActiveTab] = useState('overview');
287
  const [streams, setStreams] = useState([]);
 
44
  Filler
45
  );
46
 
47
+ // Fallback to local port 3000 in development, or use VITE_API_URL if configured, otherwise same origin
48
+ const API_BASE = import.meta.env.VITE_API_URL || (import.meta.env.DEV ? 'http://localhost:3000' : '');
49
+ const TWITCH_CHANNEL = 'winx_prinx';
50
+
51
  // 3D Galaxy Chatter Orbit Visualization
52
  function ChatterOrbit({ chatters }) {
53
  const canvasRef = useRef(null);
 
59
  // Load Avatar via backend proxy (avoids CORS issues with decapi.me)
60
  if (!avatarRef.current) {
61
  const img = new Image();
62
+ img.src = `${API_BASE}/api/avatar/${TWITCH_CHANNEL}`;
63
  img.onload = () => { avatarRef.current = img; };
64
  img.onerror = () => console.warn('[ChatterOrbit] Avatar load failed');
65
  }
 
282
  );
283
  }
284
 
 
 
 
 
285
  export default function App() {
286
  const [activeTab, setActiveTab] = useState('overview');
287
  const [streams, setStreams] = useState([]);