diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..da59292 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +# API Base URL for production +# Set this to your production domain when building +VITE_API_BASE_URL=https://annavillesda.org diff --git a/src/pages/EventDetail.jsx b/src/pages/EventDetail.jsx index 81d429c..46711e7 100644 --- a/src/pages/EventDetail.jsx +++ b/src/pages/EventDetail.jsx @@ -33,6 +33,10 @@ function resolveImageUrl(value, fallback) { if (apiBaseUrl) { return `${apiBaseUrl}${path}` } + // Fallback to current domain if no API base URL is set + if (typeof window !== 'undefined') { + return `${window.location.origin}${path}` + } return path } return fallback diff --git a/src/pages/admin/AdminEventForm.jsx b/src/pages/admin/AdminEventForm.jsx index 402f24e..da57846 100644 --- a/src/pages/admin/AdminEventForm.jsx +++ b/src/pages/admin/AdminEventForm.jsx @@ -15,6 +15,10 @@ function resolveImageUrl(value) { if (apiBaseUrl) { return `${apiBaseUrl}${path}` } + // Fallback to current domain if no API base URL is set + if (typeof window !== 'undefined') { + return `${window.location.origin}${path}` + } return path }