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 { Link } from '@tanstack/react-router'
|
||||
import { Alert, Badge, Button, LoadingBlock } from '@/ui'
|
||||
import { Badge, Button, LoadingBlock, QueryErrorState } from '@/ui'
|
||||
import { CaretLeftIcon, CaretRightIcon, ArrowSquareOutIcon } from '@phosphor-icons/react'
|
||||
import { useRecordDependents } from '@/api/queries'
|
||||
import type { OnCloseAction } from '@/api/client'
|
||||
@@ -32,7 +32,7 @@ export const RecordDependentsPanel = ({ dictionaryName, businessKey }: Props) =>
|
||||
const { t } = useTranslation()
|
||||
const [page, setPage] = useState(0)
|
||||
const size = 20
|
||||
const { data, isLoading, error } = useRecordDependents(
|
||||
const { data, isLoading, error, refetch } = useRecordDependents(
|
||||
dictionaryName,
|
||||
businessKey,
|
||||
page,
|
||||
@@ -42,11 +42,7 @@ export const RecordDependentsPanel = ({ dictionaryName, businessKey }: Props) =>
|
||||
if (!businessKey) return null
|
||||
if (isLoading) return <LoadingBlock size="sm" label={t('loading')} />
|
||||
if (error) {
|
||||
return (
|
||||
<Alert variant="error" title={t('error.failed')}>
|
||||
{String(error)}
|
||||
</Alert>
|
||||
)
|
||||
return <QueryErrorState error={error} onRetry={() => refetch()} />
|
||||
}
|
||||
if (!data || data.total === 0) return null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user