mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-05 03:02:56 +00:00
@@ -8,6 +8,7 @@ import ClubModal from '../components/home/ClubModal';
|
||||
import { usePublicSettings } from '../hooks/usePublicSettings';
|
||||
import { sortCategoriesWithOrder } from '../utils/categorySort';
|
||||
import { TeamLogo } from '../components/common/TeamLogo';
|
||||
import { API_URL } from '../services/api';
|
||||
|
||||
type TableRow = {
|
||||
rank: string;
|
||||
@@ -34,10 +35,9 @@ const resolveBackendUrl = (path: string) => {
|
||||
try {
|
||||
if (/^https?:\/\//i.test(path)) return path;
|
||||
if (path.startsWith('/cache') || path.startsWith('/uploads')) {
|
||||
const base = process.env.REACT_APP_API_BASE_URL || process.env.REACT_APP_API_URL || 'http://localhost:8080/api/v1';
|
||||
const u = new URL(base);
|
||||
u.pathname = path;
|
||||
return u.toString();
|
||||
const u = new URL(API_URL, typeof window !== 'undefined' ? window.location.origin : undefined);
|
||||
const abs = new URL(path, `${u.protocol}//${u.host}`);
|
||||
return abs.toString();
|
||||
}
|
||||
return path;
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user