From 237106f2a40660f596b27ed5057ff346aa5f9ed5 Mon Sep 17 00:00:00 2001 From: Kirill Date: Fri, 22 May 2026 15:41:50 +0500 Subject: [PATCH] fix(client): parse error message properly in ProfileSection --- client/src/pages/me/ui/sections/ProfileSection.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/pages/me/ui/sections/ProfileSection.tsx b/client/src/pages/me/ui/sections/ProfileSection.tsx index c167299..5026b19 100644 --- a/client/src/pages/me/ui/sections/ProfileSection.tsx +++ b/client/src/pages/me/ui/sections/ProfileSection.tsx @@ -7,6 +7,7 @@ import TextField from '@mui/material/TextField' import Typography from '@mui/material/Typography' import { useUnit } from 'effector-react' import { useForm } from 'react-hook-form' +import { getApiErrorMessage } from '@/shared/lib/get-api-error-message' import { $user, $updateProfileError, updateProfileFx } from '@/shared/model/auth' export function ProfileSection() { @@ -14,6 +15,8 @@ export function ProfileSection() { const pendingProfile = useUnit(updateProfileFx.pending) const updateProfileError = useUnit($updateProfileError) + const profileErrorMsg = getApiErrorMessage(updateProfileError) + const profileForm = useForm<{ displayName: string }>({ defaultValues: { displayName: user?.displayName ? String(user.displayName) : '' }, mode: 'onChange', @@ -35,9 +38,9 @@ export function ProfileSection() { slotProps={{ htmlInput: { maxLength: 40 } }} {...profileForm.register('displayName')} /> - {updateProfileError && ( + {profileErrorMsg && ( - {updateProfileError} + {profileErrorMsg} )}