This commit is contained in:
2026-05-16 01:59:23 +03:00
parent 77d396b842
commit be2a17c36b
2 changed files with 4 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
// frontend/js/api.js // frontend/js/api.js
const API_BASE = "/api"; const API_BASE = `http://${window.location.hostname}:5000/api`;
function getHeaders() { function getHeaders() {
const token = localStorage.getItem('token'); const token = localStorage.getItem('token');

View File

@@ -41,8 +41,8 @@ function showToast(message, type = 'info') {
} }
function initSocket() { function initSocket() {
// Подключаемся к текущему хосту (без хардкода localhost) // Подключаемся напрямую к бэкенду на порту 5000
socket = io(); try { socket = io(`http://${window.location.hostname}:5000`); } catch(e) { console.warn('Socket.IO:', e.message); return; }
socket.on('connect', () => { socket.on('connect', () => {
console.log('Connected to WebSocket server'); console.log('Connected to WebSocket server');