fix(ux): friendly error UI вместо raw AxiosError
This commit is contained in:
@@ -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', {
|
||||
|
||||
Reference in New Issue
Block a user