"use client" import * as React from "react" import { type Table } from "@tanstack/react-table" import { Download, RefreshCcw, Upload } from "lucide-react" import { toast } from "sonner" import { exportTableToExcel } from "@/lib/export" import { Button } from "@/components/ui/button" import { ViewTagSubfields } from "@/db/schema/vendorData" interface ItemsTableToolbarActionsProps { table: Table } export function TagNumberingTableToolbarActions({ table }: ItemsTableToolbarActionsProps) { const [isLoading, setIsLoading] = React.useState(false) const syncTags = async () => { try { setIsLoading(true) // API 엔드포인트 호출 const response = await fetch('/api/cron/tag-types') if (!response.ok) { const errorData = await response.json() throw new Error(errorData.error || 'Failed to sync tag numberings') } const data = await response.json() // 성공 메시지 표시 toast.success( `tag numberings synced successfully! ${data.result.items} items processed.` ) // 페이지 새로고침으로 테이블 데이터 업데이트 window.location.reload() } catch (error) { console.error('Error syncing tag numberings:', error) toast.error( error instanceof Error ? error.message : 'An error occurred while syncing tag numberings' ) } finally { setIsLoading(false) } } return (
{/** 4) Export 버튼 */} {/** 4) Export 버튼 */}
) }