fix(ux): friendly error UI вместо raw AxiosError

This commit is contained in:
Александр Зимин
2026-05-12 12:41:48 +00:00
parent db0986d235
commit 3984d99004
14 changed files with 274 additions and 57 deletions
@@ -1,7 +1,7 @@
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import axios from 'axios'
import { Alert, Badge, Button, Drawer, LoadingBlock, TextArea, toast } from '@/ui'
import { Badge, Button, Drawer, LoadingBlock, QueryErrorState, TextArea, toast } from '@/ui'
import {
CheckIcon,
PaperPlaneTiltIcon,
@@ -69,7 +69,7 @@ export function SchemaDraftDrawer({
const { t } = useTranslation()
const [comment, setComment] = useState('')
const [editOpen, setEditOpen] = useState(false)
const { data: draft, isLoading, error } = useDictActiveSchemaDraft(
const { data: draft, isLoading, error, refetch } = useDictActiveSchemaDraft(
open ? dictionaryName : undefined,
)
@@ -204,11 +204,7 @@ export function SchemaDraftDrawer({
>
<div className="space-y-4">
{isLoading && <LoadingBlock size="md" label={t('loading')} />}
{error && (
<Alert variant="error" title={t('error.failed')}>
{String(error)}
</Alert>
)}
{error && <QueryErrorState error={error} onRetry={() => refetch()} />}
{!isLoading && !draft && (
<p className="text-body text-mute">
{t('workflow.schemaDraft.empty', {