fix(ui): replace raw AxiosError dumps with QueryErrorState across routes

This commit is contained in:
Александр Зимин
2026-05-14 20:42:45 +00:00
parent 1a5049aac4
commit 9e6ddd1bce
5 changed files with 34 additions and 39 deletions
@@ -967,9 +967,10 @@ function DictionaryDetail() {
{recordsResult.isLoading && <LoadingBlock size="md" label={t('loading')} />}
{recordsResult.error && (
<Alert variant="error" title={t('error.failed')}>
{String(recordsResult.error)}
</Alert>
<QueryErrorState
error={recordsResult.error}
onRetry={() => recordsResult.refetch()}
/>
)}
{recordsResult.data && recordsResult.data.length === 0 && (
@@ -1279,9 +1280,10 @@ function DictionaryDetail() {
)}
{detailQuery.data && edit.kind === 'edit' && rawRecordQuery.error && (
<Alert variant="error" title={t('error.failed')}>
{String(rawRecordQuery.error)}
</Alert>
<QueryErrorState
error={rawRecordQuery.error}
onRetry={() => rawRecordQuery.refetch()}
/>
)}
{detailQuery.data && edit.kind === 'edit' && rawRecordQuery.data && (
@@ -2086,7 +2088,8 @@ function highlightJson(json: string): string {
*/
function EventsTabContent({ dictName }: { dictName: string }) {
const { t } = useTranslation()
const { data, isLoading, error } = useAudit({ dictionaryName: dictName, size: 50 })
const auditQ = useAudit({ dictionaryName: dictName, size: 50 })
const { data, isLoading, error } = auditQ
// Filter chips per prototype: все / edit / publish / review / webhook / export.
// Backend audit actions: CREATE / UPDATE / CLOSE / EXPORT etc. — map to display
// groups for chip filter.
@@ -2094,11 +2097,7 @@ function EventsTabContent({ dictName }: { dictName: string }) {
if (isLoading) return <LoadingBlock size="md" label={t('loading')} />
if (error)
return (
<Alert variant="error" title={t('error.failed')}>
{String(error)}
</Alert>
)
return <QueryErrorState error={error} onRetry={() => auditQ.refetch()} />
const rows = data?.content ?? []
if (rows.length === 0)
return (
@@ -2298,7 +2297,8 @@ function EventsTabContent({ dictName }: { dictName: string }) {
function HistoryTabContent({ detail }: { detail?: import('@/api/client').DictionaryDetail }) {
const { t } = useTranslation()
const [diffEntryId, setDiffEntryId] = useState<number | undefined>(undefined)
const { data, isLoading, error } = useChangelog(detail?.name)
const changelogQ = useChangelog(detail?.name)
const { data, isLoading, error } = changelogQ
if (!detail) return null
@@ -2306,9 +2306,7 @@ function HistoryTabContent({ detail }: { detail?: import('@/api/client').Diction
<div className="space-y-3">
{isLoading && <LoadingBlock size="md" label={t('loading')} />}
{error && (
<Alert variant="error" title={t('error.failed')}>
{String(error)}
</Alert>
<QueryErrorState error={error} onRetry={() => changelogQ.refetch()} />
)}
{data && data.entries.length === 0 && (
<EmptyState