'use client'; import { getRegisterConfig, updateRegisterConfig } from '@/services/admin/system'; import { useQuery } from '@tanstack/react-query'; import { Label } from '@workspace/ui/components/label'; import { Switch } from '@workspace/ui/components/switch'; import { Table, TableBody, TableCell, TableRow } from '@workspace/ui/components/table'; import { Textarea } from '@workspace/ui/components/textarea'; import { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input'; import { useTranslations } from 'next-intl'; import { toast } from 'sonner'; export default function Register() { const t = useTranslations('system.register'); const { data, refetch } = useQuery({ queryKey: ['getRegisterConfig'], queryFn: async () => { const { data } = await getRegisterConfig(); return data.data; }, }); async function updateConfig(key: string, value: unknown) { if (data?.[key] === value) return; try { await updateRegisterConfig({ ...data, [key]: value, } as API.RegisterConfig); toast.success(t('saveSuccess')); refetch(); } catch (error) { /* empty */ } } return (