test commit
This commit is contained in:
@@ -11,6 +11,13 @@ import { uploadAdminProductImages } from '@/entities/product/api/product-api'
|
||||
import { formatAdminImageMaxSizeHint } from '@/shared/constants/upload-limits'
|
||||
import { invalidateQueryKeys } from '@/shared/lib/invalidate-query-keys'
|
||||
import { GallerySliderSection } from './GallerySliderSection'
|
||||
import type { AxiosError } from 'axios'
|
||||
|
||||
function getApiErrorMessage(error: unknown): string | null {
|
||||
const e = error as AxiosError<{ error?: string }>
|
||||
const msg = e?.response?.data?.error
|
||||
return msg ? String(msg) : null
|
||||
}
|
||||
|
||||
export function AdminGalleryPage() {
|
||||
const queryClient = useQueryClient()
|
||||
@@ -105,9 +112,7 @@ export function AdminGalleryPage() {
|
||||
</Typography>
|
||||
)}
|
||||
{deleteMut.isError && (
|
||||
<Typography color="error">
|
||||
{deleteMut.error instanceof Error ? deleteMut.error.message : 'Ошибка удаления'}
|
||||
</Typography>
|
||||
<Typography color="error">{getApiErrorMessage(deleteMut.error) ?? 'Ошибка удаления'}</Typography>
|
||||
)}
|
||||
</Stack>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user