diff --git a/src/app/[locale]/(protected)/accounting/bills/page.tsx b/src/app/[locale]/(protected)/accounting/bills/page.tsx index 0332c219..052cd949 100644 --- a/src/app/[locale]/(protected)/accounting/bills/page.tsx +++ b/src/app/[locale]/(protected)/accounting/bills/page.tsx @@ -47,7 +47,7 @@ async function getBills(params: { queryParams.append('per_page', '20'); const response = await fetch( - `${process.env.API_URL}/api/v1/bills?${queryParams.toString()}`, + `${process.env.NEXT_PUBLIC_API_URL}/api/v1/bills?${queryParams.toString()}`, { method: 'GET', headers, cache: 'no-store' } ); diff --git a/src/app/[locale]/(protected)/sales/pricing-management/page.tsx b/src/app/[locale]/(protected)/sales/pricing-management/page.tsx index 7934002d..5b9ef67e 100644 --- a/src/app/[locale]/(protected)/sales/pricing-management/page.tsx +++ b/src/app/[locale]/(protected)/sales/pricing-management/page.tsx @@ -150,7 +150,7 @@ async function getItemsList(): Promise { const headers = await getApiHeaders(); const response = await fetch( - `${process.env.API_URL}/api/v1/items?group_id=1&size=100`, + `${process.env.NEXT_PUBLIC_API_URL}/api/v1/items?group_id=1&size=100`, { method: 'GET', headers, @@ -183,7 +183,7 @@ async function getPricingList(): Promise { const headers = await getApiHeaders(); const response = await fetch( - `${process.env.API_URL}/api/v1/pricing?size=100`, + `${process.env.NEXT_PUBLIC_API_URL}/api/v1/pricing?size=100`, { method: 'GET', headers, diff --git a/src/components/attendance/actions.ts b/src/components/attendance/actions.ts index 2055cbe5..41b7f2c7 100644 --- a/src/components/attendance/actions.ts +++ b/src/components/attendance/actions.ts @@ -104,7 +104,7 @@ export async function checkIn( data: CheckInRequest ): Promise<{ success: boolean; data?: AttendanceRecord; error?: string; __authError?: boolean }> { try { - const { response, error } = await serverFetch(`${process.env.API_URL}/v1/attendances/check-in`, { + const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/attendances/check-in`, { method: 'POST', body: JSON.stringify({ user_id: data.userId, @@ -158,7 +158,7 @@ export async function checkOut( ): Promise<{ success: boolean; data?: AttendanceRecord; error?: string }> { try { const headers = await getApiHeaders(); - const response = await fetch(`${process.env.API_URL}/v1/attendances/check-out`, { + const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/attendances/check-out`, { method: 'POST', headers, body: JSON.stringify({ @@ -218,7 +218,7 @@ export async function getTodayAttendance(): Promise<{ const today = new Date().toISOString().split('T')[0]; const { response, error } = await serverFetch( - `${process.env.API_URL}/v1/attendances?date=${today}&per_page=1`, + `${process.env.NEXT_PUBLIC_API_URL}/v1/attendances?date=${today}&per_page=1`, { method: 'GET', } diff --git a/src/components/hr/CardManagement/actions.ts b/src/components/hr/CardManagement/actions.ts index df9a562b..bee10246 100644 --- a/src/components/hr/CardManagement/actions.ts +++ b/src/components/hr/CardManagement/actions.ts @@ -55,7 +55,7 @@ interface CardResponse { } // API URL (without double /api) -const API_URL = `${process.env.NEXT_PUBLIC_API_URL || process.env.API_URL}/api`; +const API_URL = `${process.env.NEXT_PUBLIC_API_URL}/api`; // 상태 매핑: API → Frontend function mapApiStatusToFrontend(apiStatus: 'active' | 'inactive'): CardStatus { diff --git a/src/components/hr/EmployeeManagement/actions.ts b/src/components/hr/EmployeeManagement/actions.ts index b6c806f3..05fc9d2c 100644 --- a/src/components/hr/EmployeeManagement/actions.ts +++ b/src/components/hr/EmployeeManagement/actions.ts @@ -371,7 +371,7 @@ export async function getPositions(type?: 'rank' | 'title'): Promise { const headers = await getApiHeaders(); const response = await fetch( - `${process.env.API_URL}/api/v1/departments`, + `${process.env.NEXT_PUBLIC_API_URL}/api/v1/departments`, { method: 'GET', headers, diff --git a/src/components/hr/EmployeeManagement/utils.ts b/src/components/hr/EmployeeManagement/utils.ts index ebfdf77d..d901c9e0 100644 --- a/src/components/hr/EmployeeManagement/utils.ts +++ b/src/components/hr/EmployeeManagement/utils.ts @@ -22,7 +22,7 @@ import type { // 프로필 이미지 URL 변환 // ============================================ -const API_URL = process.env.NEXT_PUBLIC_API_URL || process.env.API_URL || ''; +const API_URL = process.env.NEXT_PUBLIC_API_URL || ''; /** * 프로필 이미지 경로를 전체 URL로 변환 diff --git a/src/components/hr/SalaryManagement/actions.ts b/src/components/hr/SalaryManagement/actions.ts index 1d06ce2d..29da783c 100644 --- a/src/components/hr/SalaryManagement/actions.ts +++ b/src/components/hr/SalaryManagement/actions.ts @@ -86,7 +86,7 @@ interface BulkUpdateResponse { } // API URL -const API_URL = `${process.env.NEXT_PUBLIC_API_URL || process.env.API_URL}/api`; +const API_URL = `${process.env.NEXT_PUBLIC_API_URL}/api`; // API → Frontend 변환 (목록용) function transformApiToFrontend(apiData: SalaryApiData): SalaryRecord { diff --git a/src/components/hr/VacationManagement/actions.ts b/src/components/hr/VacationManagement/actions.ts index 0f59ffd9..cef02bfc 100644 --- a/src/components/hr/VacationManagement/actions.ts +++ b/src/components/hr/VacationManagement/actions.ts @@ -172,7 +172,7 @@ interface PaginatedResponse { } // API URL -const API_URL = `${process.env.NEXT_PUBLIC_API_URL || process.env.API_URL}/api`; +const API_URL = `${process.env.NEXT_PUBLIC_API_URL}/api`; /** * API 응답에서 프론트엔드 형식으로 변환 diff --git a/src/components/items/ItemDetailClient.tsx b/src/components/items/ItemDetailClient.tsx index 28928983..0097d906 100644 --- a/src/components/items/ItemDetailClient.tsx +++ b/src/components/items/ItemDetailClient.tsx @@ -86,7 +86,7 @@ function getStorageUrl(path: string | undefined): string | null { return path; } // 상대 경로인 경우 - const apiUrl = process.env.API_URL || ''; + const apiUrl = process.env.NEXT_PUBLIC_API_URL || ''; return `${apiUrl}/storage/${path}`; } diff --git a/src/components/process-management/actions.ts b/src/components/process-management/actions.ts index 2f770948..9a646002 100644 --- a/src/components/process-management/actions.ts +++ b/src/components/process-management/actions.ts @@ -139,7 +139,7 @@ export async function getProcessList(params?: { if (params?.process_type) searchParams.set('process_type', params.process_type); const { response, error } = await serverFetch( - `${process.env.API_URL}/v1/processes?${searchParams.toString()}`, + `${process.env.NEXT_PUBLIC_API_URL}/v1/processes?${searchParams.toString()}`, { method: 'GET', cache: 'no-store' } ); @@ -177,7 +177,7 @@ export async function getProcessList(params?: { */ export async function getProcessById(id: string): Promise<{ success: boolean; data?: Process; error?: string; __authError?: boolean }> { try { - const { response, error } = await serverFetch(`${process.env.API_URL}/v1/processes/${id}`, { + const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/${id}`, { method: 'GET', cache: 'no-store', }); @@ -210,7 +210,7 @@ export async function createProcess(data: ProcessFormData): Promise<{ success: b try { const apiData = transformFrontendToApi(data); - const { response, error } = await serverFetch(`${process.env.API_URL}/v1/processes`, { + const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes`, { method: 'POST', body: JSON.stringify(apiData), }); @@ -243,7 +243,7 @@ export async function updateProcess(id: string, data: ProcessFormData): Promise< try { const apiData = transformFrontendToApi(data); - const { response, error } = await serverFetch(`${process.env.API_URL}/v1/processes/${id}`, { + const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/${id}`, { method: 'PUT', body: JSON.stringify(apiData), }); @@ -274,7 +274,7 @@ export async function updateProcess(id: string, data: ProcessFormData): Promise< */ export async function deleteProcess(id: string): Promise<{ success: boolean; error?: string; __authError?: boolean }> { try { - const { response, error } = await serverFetch(`${process.env.API_URL}/v1/processes/${id}`, { + const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/${id}`, { method: 'DELETE', }); @@ -304,7 +304,7 @@ export async function deleteProcess(id: string): Promise<{ success: boolean; err */ export async function deleteProcesses(ids: string[]): Promise<{ success: boolean; deletedCount?: number; error?: string; __authError?: boolean }> { try { - const { response, error } = await serverFetch(`${process.env.API_URL}/v1/processes`, { + const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes`, { method: 'DELETE', body: JSON.stringify({ ids: ids.map((id) => parseInt(id, 10)) }), }); @@ -335,7 +335,7 @@ export async function deleteProcesses(ids: string[]): Promise<{ success: boolean */ export async function toggleProcessActive(id: string): Promise<{ success: boolean; data?: Process; error?: string; __authError?: boolean }> { try { - const { response, error } = await serverFetch(`${process.env.API_URL}/v1/processes/${id}/toggle`, { + const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/${id}/toggle`, { method: 'PATCH', }); @@ -370,7 +370,7 @@ export async function getProcessOptions(): Promise<{ __authError?: boolean; }> { try { - const { response, error } = await serverFetch(`${process.env.API_URL}/v1/processes/options`, { + const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/options`, { method: 'GET', cache: 'no-store', }); @@ -416,7 +416,7 @@ export async function getProcessStats(): Promise<{ __authError?: boolean; }> { try { - const { response, error } = await serverFetch(`${process.env.API_URL}/v1/processes/stats`, { + const { response, error } = await serverFetch(`${process.env.NEXT_PUBLIC_API_URL}/v1/processes/stats`, { method: 'GET', cache: 'no-store', });