fix: Update WebSocket and API URLs to use environment variables for better configuration

This commit is contained in:
MayaTheShy
2026-02-16 00:29:19 -05:00
parent a8a99f4f53
commit 9f9abb45ec

View File

@@ -1,7 +1,11 @@
import { create } from 'zustand';
const WS_URL = 'ws://localhost:3002';
const API_URL = 'http://localhost:3001';
// Use environment variables or fallback to relative URLs for proxy
const WS_URL = import.meta.env.VITE_WS_URL || `${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}/ws`;
const API_URL = import.meta.env.VITE_API_URL || `${window.location.protocol}//${window.location.host}/api`;
console.log('🔌 WebSocket URL:', WS_URL);
console.log('📡 API URL:', API_URL);
export const useTurtleStore = create((set, get) => ({
// State