'use client'; import { getVerifyConfig, updateVerifyConfig } 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 { EnhancedInput } from '@workspace/ui/custom-components/enhanced-input'; import { useTranslations } from 'next-intl'; import { toast } from 'sonner'; export default function Verify() { const t = useTranslations('system.verify'); const { data, refetch } = useQuery({ queryKey: ['getVerifyConfig'], queryFn: async () => { const { data } = await getVerifyConfig(); return data.data; }, }); async function updateConfig(key: string, value: unknown) { if (data?.[key] === value) return; try { await updateVerifyConfig({ ...data, [key]: value, } as API.VerifyConfig); toast.success(t('saveSuccess')); refetch(); } catch (error) { /* empty */ } } return (

{t('turnstileSiteKeyDescription')}

updateConfig('turnstile_site_key', value)} />

{t('turnstileSecretDescription')}

updateConfig('turnstile_secret', value)} />

{t('registrationVerificationCodeDescription')}

{ updateConfig('enable_register_verify', checked); }} />

{t('loginVerificationCodeDescription')}

{ updateConfig('enable_login_verify', checked); }} />

{t('resetPasswordVerificationCodeDescription')}

{ updateConfig('enable_reset_password_verify', checked); }} />
); }