From c4644489e76a56d47e671dbfc0b4908a05f2db77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Tue, 27 Jan 2026 15:21:49 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20getItemCategoryTree=20serverFetch=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - URL에 NEXT_PUBLIC_API_URL 추가 - serverFetch 반환값 { response, error } 구조로 수정 --- src/components/quotes/actions.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/quotes/actions.ts b/src/components/quotes/actions.ts index 3d4630a0..36cc4c69 100644 --- a/src/components/quotes/actions.ts +++ b/src/components/quotes/actions.ts @@ -1148,12 +1148,19 @@ export async function getItemCategoryTree(): Promise<{ __authError?: boolean; }> { try { - const response = await serverFetch('/api/v1/categories/tree?code_group=item_category&only_active=true'); + const url = `${process.env.NEXT_PUBLIC_API_URL}/api/v1/categories/tree?code_group=item_category&only_active=true`; + const { response, error } = await serverFetch(url, { method: 'GET' }); - if (!response.ok) { - if (response.status === 401) { - return { success: false, data: [], error: '인증이 필요합니다.', __authError: true }; - } + if (error) { + return { + success: false, + data: [], + error: error.message, + __authError: error.code === 'UNAUTHORIZED', + }; + } + + if (!response || !response.ok) { return { success: false, data: [], error: '카테고리 조회 실패' }; }