From 87e60e73095be69655d0a9825f87c0f62c1f702b Mon Sep 17 00:00:00 2001 From: nns Date: Sat, 30 May 2026 12:59:37 +0500 Subject: [PATCH] =?UTF-8?q?fix(employees):=20error=20display=20=D1=87?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=B7=20humanizeError,=20=D0=BD=D0=B5=20?= =?UTF-8?q?=C2=ABRequest=20failed=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Найдено через UI-deep: EmployeesPage в catch'е save'a доставал err.response.data.error || err.message и показывал в модалке. На 400-ках с ProblemDetails (errors.{field}:[msg]) error отсутствовал и попадал generic axios «Request failed with status code 400». Фикс: используем общий humanizeError() (тот же что в toast'е). Co-Authored-By: Claude Opus 4.7 --- src/food-market.web/src/pages/EmployeesPage.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/food-market.web/src/pages/EmployeesPage.tsx b/src/food-market.web/src/pages/EmployeesPage.tsx index f73295a..9ab4814 100644 --- a/src/food-market.web/src/pages/EmployeesPage.tsx +++ b/src/food-market.web/src/pages/EmployeesPage.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react' import { useQuery } from '@tanstack/react-query' import { validateEmail, validatePhone } from '@/lib/validation' import { Plus, Trash2, Copy } from 'lucide-react' -import { api } from '@/lib/api' +import { api, humanizeError } from '@/lib/api' import { ListPageShell } from '@/components/ListPageShell' import { DataTable } from '@/components/DataTable' import { Pagination } from '@/components/Pagination' @@ -146,8 +146,10 @@ export function EmployeesPage() { } } } catch (e) { - const err = e as { response?: { data?: { error?: string } }, message?: string } - const msg = err.response?.data?.error ?? err.message ?? 'Не удалось сохранить' + // Toast уже показал понятную ошибку через api interceptor; здесь + // дублируем в модалке с тем же текстом для контекста (чтобы видеть + // прямо в форме что не так — не убегая глазами в правый верхний угол). + const msg = humanizeError(e as Error) setBlockedDelete({ title: 'Не удалось сохранить', body: msg }) } }