fix hardcoded domain url to by current domain
All checks were successful
Build and deploy / Build and Push Docker Images (push) Successful in 3m44s

This commit is contained in:
2025-12-13 16:34:52 +05:00
parent cf0a39c43b
commit 42bca3d114
3 changed files with 6 additions and 4 deletions

View File

@@ -51,9 +51,9 @@ export function useMapWebSocket({
// Get the token for authenticated users
const token = authService.getAccessToken();
// Build WebSocket URL
// Build WebSocket URL - always use current domain
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsHost = import.meta.env.VITE_API_URL?.replace(/^https?:\/\//, '') || window.location.host;
const wsHost = window.location.host;
let wsUrl = `${wsProtocol}//${wsHost}/ws/maps/${mapId}`;
// Add authentication

View File

@@ -1,6 +1,7 @@
import axios from 'axios';
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000';
// Always use current domain - nginx proxies /api to backend
const API_URL = window.location.origin;
export const apiClient = axios.create({
baseURL: API_URL,

View File

@@ -25,7 +25,8 @@ class UploadService {
}
getImageUrl(path: string): string {
const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:8000';
// Always use current domain
const apiUrl = window.location.origin;
// If it's a path like /api/uploads/image/xxx.jpg
if (path.startsWith('/api/uploads/image/')) {