mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-05 03:02:56 +00:00
@@ -1,4 +1,5 @@
|
||||
import { assetUrl } from '../utils/url';
|
||||
import { API_URL } from './api';
|
||||
|
||||
export interface RelatedClub {
|
||||
id: string;
|
||||
@@ -21,8 +22,7 @@ const resolveBackendUrl = (path: string): string => {
|
||||
try {
|
||||
if (/^https?:\/\//i.test(path)) return path;
|
||||
if (path.startsWith('/cache') || path.startsWith('/uploads') || path.startsWith('/api/')) {
|
||||
const base = process.env.REACT_APP_API_BASE_URL || process.env.REACT_APP_API_URL || 'http://localhost:8080/api/v1';
|
||||
const origin = new URL(base).origin;
|
||||
const origin = new URL(API_URL, typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000').origin;
|
||||
return new URL(path, origin).toString();
|
||||
}
|
||||
return path;
|
||||
|
||||
Reference in New Issue
Block a user