Fix: Use NEXT_PUBLIC_API_URL for all image URLs

This commit is contained in:
AutonetSellCar Deploy
2025-12-30 16:09:06 +09:00
parent a3d5339c84
commit 0ccc2f75c5
5 changed files with 240 additions and 4 deletions

View File

@@ -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);