Files
frontend/apps/cm/src/pages/dashboard/api/support.ts
T
2025-12-12 19:09:20 +09:00

45 lines
1.2 KiB
TypeScript

import { ENDPOINT } from "@/shared/config";
export interface Support {
total: number;
ongoing: number;
han: number;
youngsang: number;
geum: number;
nakdong: number;
type: string;
}
export const getSupportList = async () => {
const url = `/api/proxy${ENDPOINT.IC_SERVICE.GROUPING_STATISTICS}`;
console.log("[getSupportList] API 호출 시작 (프록시, 인증 없음):", url);
try {
const response = await fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
accept: "application/json",
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log("[getSupportList] API 응답 성공:", data);
return data;
} catch (error: unknown) {
const err = error as
| { status?: number; message?: string; response?: { status?: number } }
| undefined;
console.error("[getBannerList] API 호출 실패:", {
url,
error: err,
status: err?.status ?? err?.response?.status,
message: err instanceof Error ? err.message : String(err),
});
throw error;
}
};