fix(ux): friendly error UI вместо raw AxiosError
This commit is contained in:
@@ -2,7 +2,6 @@ import { useEffect, useMemo, useState } from 'react'
|
||||
import { createFileRoute, useNavigate } from '@tanstack/react-router'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
Alert,
|
||||
Badge,
|
||||
Button,
|
||||
DatePicker,
|
||||
@@ -10,6 +9,7 @@ import {
|
||||
IconButton,
|
||||
LoadingBlock,
|
||||
PageHeader,
|
||||
QueryErrorState,
|
||||
SingleSelect,
|
||||
Table,
|
||||
TableBody,
|
||||
@@ -266,9 +266,7 @@ function AuditPage() {
|
||||
)}
|
||||
|
||||
{error ? (
|
||||
<Alert variant="error" title={t('error.failed')}>
|
||||
{String(error)}
|
||||
</Alert>
|
||||
<QueryErrorState error={error} onRetry={() => refetch()} />
|
||||
) : isLoading ? (
|
||||
<LoadingBlock size="md" label={t('loading')} />
|
||||
) : !data || data.content.length === 0 ? (
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
IconButton,
|
||||
LoadingBlock,
|
||||
Modal,
|
||||
QueryErrorState,
|
||||
SearchInput,
|
||||
Table,
|
||||
TableBody,
|
||||
@@ -629,11 +630,7 @@ function DictionaryDetail() {
|
||||
)
|
||||
}
|
||||
if (detailQuery.error) {
|
||||
return (
|
||||
<Alert variant="error" title={t('error.failed')}>
|
||||
{String(detailQuery.error)}
|
||||
</Alert>
|
||||
)
|
||||
return <QueryErrorState error={detailQuery.error} onRetry={() => detailQuery.refetch()} />
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import { useDeferredValue, useMemo, useState } from 'react'
|
||||
import { createFileRoute, useNavigate } from '@tanstack/react-router'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { Alert, Badge, Button, EmptyState, LoadingBlock, PageHeader } from '@/ui'
|
||||
import { Badge, Button, EmptyState, LoadingBlock, PageHeader, QueryErrorState } from '@/ui'
|
||||
import { PlusIcon } from '@phosphor-icons/react'
|
||||
import { useQueries } from '@tanstack/react-query'
|
||||
import { dictionaryDependentsQuery, useDictionaries, useDictionaryDependents, useRecords } from '@/api/queries'
|
||||
@@ -94,7 +94,7 @@ function DictionariesPage() {
|
||||
const { t } = useTranslation()
|
||||
const navigate = useNavigate({ from: '/dictionaries/' })
|
||||
const search = Route.useSearch()
|
||||
const { data, isLoading, error } = useDictionaries()
|
||||
const { data, isLoading, error, refetch } = useDictionaries()
|
||||
const [createOpen, setCreateOpen] = useState(false)
|
||||
const canMutate = useCanMutate()
|
||||
|
||||
@@ -193,11 +193,7 @@ function DictionariesPage() {
|
||||
)
|
||||
}
|
||||
if (error) {
|
||||
return (
|
||||
<Alert variant="error" title={t('error.failed')}>
|
||||
{String(error)}
|
||||
</Alert>
|
||||
)
|
||||
return <QueryErrorState error={error} onRetry={() => refetch()} />
|
||||
}
|
||||
if (!data || data.length === 0) {
|
||||
return (
|
||||
|
||||
@@ -2,12 +2,12 @@ import { useState } from 'react'
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
Alert,
|
||||
Badge,
|
||||
Button,
|
||||
EmptyState,
|
||||
LoadingBlock,
|
||||
PageHeader,
|
||||
QueryErrorState,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
@@ -64,9 +64,7 @@ function OutboxPage() {
|
||||
</div>
|
||||
|
||||
{dlq.error ? (
|
||||
<Alert variant="error" title={t('error.failed')}>
|
||||
{String(dlq.error)}
|
||||
</Alert>
|
||||
<QueryErrorState error={dlq.error} onRetry={() => dlq.refetch()} />
|
||||
) : dlq.isLoading ? (
|
||||
<LoadingBlock size="md" label={t('loading')} />
|
||||
) : !dlq.data || dlq.data.content.length === 0 ? (
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
Tabs,
|
||||
TextArea,
|
||||
TextInput,
|
||||
QueryErrorState,
|
||||
} from '@/ui'
|
||||
import { CheckCircleIcon, XCircleIcon } from '@phosphor-icons/react'
|
||||
import { useDraft, useLiveRecord, useReviewQueue, useSchemaReviewQueue } from '@/api/queries'
|
||||
@@ -204,9 +205,7 @@ function ReviewsPage() {
|
||||
)}
|
||||
|
||||
{activeTab === 'records' && queue.error && (
|
||||
<Alert variant="error" title={t('error.failed')}>
|
||||
{String(queue.error)}
|
||||
</Alert>
|
||||
<QueryErrorState error={queue.error} onRetry={() => queue.refetch()} />
|
||||
)}
|
||||
|
||||
{activeTab === 'records' && bulkResult && (
|
||||
|
||||
@@ -2,12 +2,12 @@ import { useState } from 'react'
|
||||
import { createFileRoute, Link, useNavigate } from '@tanstack/react-router'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
Alert,
|
||||
Badge,
|
||||
EmptyState,
|
||||
LoadingBlock,
|
||||
PageHeader,
|
||||
Panel,
|
||||
QueryErrorState,
|
||||
SearchInput,
|
||||
} from '@/ui'
|
||||
import { useSearch } from '@/api/queries'
|
||||
@@ -78,9 +78,7 @@ function SearchPage() {
|
||||
)}
|
||||
|
||||
{hasQuery && result.error && (
|
||||
<Alert variant="error" title={t('error.failed')}>
|
||||
{String(result.error)}
|
||||
</Alert>
|
||||
<QueryErrorState error={result.error} onRetry={() => result.refetch()} />
|
||||
)}
|
||||
|
||||
{hasQuery && result.data && result.data.total === 0 && (
|
||||
|
||||
Reference in New Issue
Block a user