import { useState } from 'react' import { checkCodesPublic, checkCodesAuth } from '../services/api' import { ResultsTable } from '../components/ResultsTable' import type { CodeResult } from '../types' export function CheckCodesPage() { const [codesInput, setCodesInput] = useState('') const [results, setResults] = useState(null) const [loading, setLoading] = useState(false) const [error, setError] = useState('') async function handleCheck(mode: 'public' | 'auth') { const codes = codesInput .split(/[\n,;]+/) .map(c => c.trim()) .filter(Boolean) if (codes.length === 0) { setError('Введите хотя бы один код маркировки') return } setLoading(true) setError('') try { const fn = mode === 'public' ? checkCodesPublic : checkCodesAuth const response = await fn(codes) setResults(response.results) } catch (err) { setError(String(err)) } finally { setLoading(false) } } return (

Проверка кодов маркировки (КМ)