fix hardcoded domain url to by current domain
All checks were successful
Build and deploy / Build and Push Docker Images (push) Successful in 3m44s
All checks were successful
Build and deploy / Build and Push Docker Images (push) Successful in 3m44s
This commit is contained in:
@@ -51,9 +51,9 @@ export function useMapWebSocket({
|
|||||||
// Get the token for authenticated users
|
// Get the token for authenticated users
|
||||||
const token = authService.getAccessToken();
|
const token = authService.getAccessToken();
|
||||||
|
|
||||||
// Build WebSocket URL
|
// Build WebSocket URL - always use current domain
|
||||||
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
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}`;
|
let wsUrl = `${wsProtocol}//${wsHost}/ws/maps/${mapId}`;
|
||||||
|
|
||||||
// Add authentication
|
// Add authentication
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import axios from 'axios';
|
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({
|
export const apiClient = axios.create({
|
||||||
baseURL: API_URL,
|
baseURL: API_URL,
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ class UploadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getImageUrl(path: string): string {
|
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 it's a path like /api/uploads/image/xxx.jpg
|
||||||
if (path.startsWith('/api/uploads/image/')) {
|
if (path.startsWith('/api/uploads/image/')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user