Fix: Use NEXT_PUBLIC_API_URL for all image URLs
This commit is contained in:
@@ -103,13 +103,15 @@ const FUEL_TYPES = [
|
||||
{ value: 'LPG', label: 'LPG' },
|
||||
];
|
||||
|
||||
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
|
||||
|
||||
// 이미지 URL 변환 (로컬 경로는 백엔드 URL 추가)
|
||||
const getImageUrl = (url: string | undefined): string => {
|
||||
if (!url) return '';
|
||||
if (url.startsWith('http://') || url.startsWith('https://')) {
|
||||
return url;
|
||||
}
|
||||
return `http://localhost:8000${url}`;
|
||||
return `${API_BASE_URL}${url}`;
|
||||
};
|
||||
|
||||
const YEAR_OPTIONS = Array.from({ length: 15 }, (_, i) => 2024 - i);
|
||||
|
||||
@@ -33,13 +33,15 @@ const defaultFormData: BannerFormData = {
|
||||
car_id: null,
|
||||
};
|
||||
|
||||
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
|
||||
|
||||
// 이미지 URL 변환 (로컬 경로는 백엔드 URL 추가)
|
||||
const getImageUrl = (url: string | undefined): string => {
|
||||
if (!url) return '';
|
||||
if (url.startsWith('http://') || url.startsWith('https://')) {
|
||||
return url;
|
||||
}
|
||||
return `http://localhost:8000${url}`;
|
||||
return `${API_BASE_URL}${url}`;
|
||||
};
|
||||
|
||||
export default function HeroBannersPage() {
|
||||
@@ -97,7 +99,7 @@ export default function HeroBannersPage() {
|
||||
.map((b: any) => b.car_id);
|
||||
if (carIds.length > 0) {
|
||||
try {
|
||||
const response = await fetch('http://localhost:8000/api/carmodoo/pdf-status', {
|
||||
const response = await fetch(`${API_BASE_URL}/api/carmodoo/pdf-status`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(carIds),
|
||||
|
||||
Reference in New Issue
Block a user