대시보드 위젯 렌더링 수정 및 외부 API 키 통합
- DashboardViewer에 ListSummaryWidget 연결 - list 위젯이 실제 DB 데이터 표시하도록 수정 - ITS_API_KEY (국토교통부 교통사고 API) 추가 - KMA_API_KEY (기상청 특보 API) 재적용 - dashboard.ts API URL 수정 (/api로 통일)
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
import React, { useState, useEffect, useCallback } from "react";
|
||||
import { DashboardElement, QueryResult } from "@/components/admin/dashboard/types";
|
||||
import { ChartRenderer } from "@/components/admin/dashboard/charts/ChartRenderer";
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
// 위젯 동적 import
|
||||
const ListSummaryWidget = dynamic(() => import("./widgets/ListSummaryWidget"), { ssr: false });
|
||||
|
||||
interface DashboardViewerProps {
|
||||
elements: DashboardElement[];
|
||||
@@ -198,8 +202,11 @@ function ViewerElement({ element, data, isLoading, onRefresh }: ViewerElementPro
|
||||
<div className="h-[calc(100%-57px)]">
|
||||
{element.type === "chart" ? (
|
||||
<ChartRenderer element={element} data={data} width={element.size.width} height={element.size.height - 57} />
|
||||
) : element.subtype === "list" ? (
|
||||
// 리스트 위젯
|
||||
<ListSummaryWidget element={element} />
|
||||
) : (
|
||||
// 위젯 렌더링
|
||||
// 기타 위젯 렌더링
|
||||
<div className="flex h-full w-full items-center justify-center bg-gradient-to-br from-blue-400 to-purple-600 p-4 text-white">
|
||||
<div className="text-center">
|
||||
<div className="mb-2 text-3xl">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { DashboardElement } from "@/components/admin/dashboard/types";
|
||||
|
||||
// API 기본 설정
|
||||
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001/api";
|
||||
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "/api";
|
||||
|
||||
// 토큰 가져오기 (실제 인증 시스템에 맞게 수정)
|
||||
function getAuthToken(): string | null {
|
||||
|
||||
Reference in New Issue
Block a user