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: '카테고리 조회 실패' }; }