diff --git a/client/src/store/turtleStore.js b/client/src/store/turtleStore.js index e7a4841..26b68b1 100644 --- a/client/src/store/turtleStore.js +++ b/client/src/store/turtleStore.js @@ -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