'use client'; import { getVerifyCodeConfig, updateVerifyCodeConfig } from '@/services/admin/system'; import { useQuery } from '@tanstack/react-query'; import { Card, CardContent, CardHeader, CardTitle } from '@workspace/ui/components/card'; import { Label } from '@workspace/ui/components/label'; 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 function VerifyCode() { const t = useTranslations('auth-control.verify-code'); const { data, refetch } = useQuery({ queryKey: ['getVerifyCodeConfig'], queryFn: async () => { const { data } = await getVerifyCodeConfig(); return data.data; }, }); async function updateConfig(key: string, value: unknown) { if (data?.[key] === value) return; try { await updateVerifyCodeConfig({ ...data, [key]: value, } as API.VerifyCodeConfig); toast.success(t('saveSuccess')); refetch(); } catch (error) { /* empty */ } } return ( {t('verifyCodeSettings')}

{t('expireTimeDescription')}

updateConfig('verify_code_expire_time', Number(value))} suffix={t('second')} />

{t('intervalDescription')}

updateConfig('verify_code_interval', Number(value))} suffix={t('second')} />

{t('dailyLimitDescription')}

updateConfig('verify_code_limit', Number(value))} suffix={t('times')} />
); }