mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 02:32:57 +00:00
@@ -15,6 +15,7 @@ import {
|
||||
VStack,
|
||||
} from '@chakra-ui/react';
|
||||
import { Download, ExternalLink } from 'lucide-react';
|
||||
import { API_URL } from '../../services/api';
|
||||
|
||||
interface PhotoModalProps {
|
||||
isOpen: boolean;
|
||||
@@ -34,8 +35,7 @@ const PhotoModal: React.FC<PhotoModalProps> = ({
|
||||
const toast = useToast();
|
||||
|
||||
const getProxyUrl = (url: string) => {
|
||||
const apiUrl = process.env.REACT_APP_API_URL || 'http://localhost:8080';
|
||||
return `${apiUrl}/api/v1/gallery/proxy-image?url=${encodeURIComponent(url)}`;
|
||||
return `${API_URL}/gallery/proxy-image?url=${encodeURIComponent(url)}`;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export const MatchesWidget = () => {
|
||||
const resolveUrl = (path: string) => {
|
||||
try {
|
||||
if (/^https?:\/\//i.test(path)) return path;
|
||||
const origin = new URL(API_URL, typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000').origin;
|
||||
const origin = new URL(API_URL, window.location.origin).origin;
|
||||
return origin + path;
|
||||
} catch {
|
||||
return path;
|
||||
@@ -108,7 +108,7 @@ export const MatchesWidget = () => {
|
||||
}
|
||||
const chosen = candidate || orig;
|
||||
if (typeof chosen === 'string' && chosen.startsWith('/')) {
|
||||
const origin = new URL(API_URL, typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000').origin;
|
||||
const origin = new URL(API_URL, window.location.origin).origin;
|
||||
return origin + chosen;
|
||||
}
|
||||
return chosen || (assetUrl('/dist/img/logo-club-empty.svg') as string);
|
||||
@@ -120,7 +120,7 @@ export const MatchesWidget = () => {
|
||||
queryKey: ['upcomingMatchesCache'],
|
||||
queryFn: async () => {
|
||||
// Build absolute origin from API URL env (which may include /api/v1)
|
||||
const origin = new URL(API_URL, typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000').origin;
|
||||
const origin = new URL(API_URL, window.location.origin).origin;
|
||||
const url = `${origin}/cache/prefetch/facr_club_info.json`;
|
||||
|
||||
const res = await fetch(url, { headers: { 'Cache-Control': 'no-cache' } });
|
||||
|
||||
Reference in New Issue
Block a user