6
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// frontend/js/api.js
|
||||
const API_BASE = "/api";
|
||||
const API_BASE = `http://${window.location.hostname}:5000/api`;
|
||||
|
||||
|
||||
function getHeaders() {
|
||||
const token = localStorage.getItem('token');
|
||||
|
||||
@@ -41,8 +41,8 @@ function showToast(message, type = 'info') {
|
||||
}
|
||||
|
||||
function initSocket() {
|
||||
// Подключаемся к текущему хосту (без хардкода localhost)
|
||||
socket = io();
|
||||
// Подключаемся напрямую к бэкенду на порту 5000
|
||||
try { socket = io(`http://${window.location.hostname}:5000`); } catch(e) { console.warn('Socket.IO:', e.message); return; }
|
||||
|
||||
socket.on('connect', () => {
|
||||
console.log('Connected to WebSocket server');
|
||||
|
||||
Reference in New Issue
Block a user