6
This commit is contained in:
@@ -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');
|
||||||
|
|||||||
@@ -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');
|
||||||
|
|||||||
Reference in New Issue
Block a user