diff --git a/client/src/pages/me/ui/sections/AuthMethodsSection.tsx b/client/src/pages/me/ui/sections/AuthMethodsSection.tsx index 4c36f4f..79ae7f1 100644 --- a/client/src/pages/me/ui/sections/AuthMethodsSection.tsx +++ b/client/src/pages/me/ui/sections/AuthMethodsSection.tsx @@ -1,4 +1,5 @@ import { useCallback, useEffect, useState } from 'react' +import Alert from '@mui/material/Alert' import Box from '@mui/material/Box' import Button from '@mui/material/Button' import Chip from '@mui/material/Chip' @@ -24,6 +25,7 @@ export function AuthMethodsSection() { const [authMethods, setAuthMethods] = useState([]) const [showSetPassword, setShowSetPassword] = useState(false) + const [fetchError, setFetchError] = useState(null) const passwordForm = useForm<{ password: string; passwordConfirm: string }>({ defaultValues: { password: '', passwordConfirm: '' }, }) @@ -31,8 +33,9 @@ export function AuthMethodsSection() { useEffect(() => { fetchAuthMethodsFx() .then(setAuthMethods) - .catch(() => { + .catch((err) => { setAuthMethods([]) + setFetchError(err?.message || 'Не удалось загрузить методы авторизации') }) }, []) @@ -81,6 +84,11 @@ export function AuthMethodsSection() { Методы входа + {fetchError && ( + + {fetchError} + + )} {authMethods.map((m) => ( diff --git a/client/src/pages/me/ui/sections/AvatarSection.tsx b/client/src/pages/me/ui/sections/AvatarSection.tsx index dd5b656..2e4b971 100644 --- a/client/src/pages/me/ui/sections/AvatarSection.tsx +++ b/client/src/pages/me/ui/sections/AvatarSection.tsx @@ -66,7 +66,12 @@ export function AvatarSection() { Стиль - setSelectedStyle(e.target.value)} + > {AVATAR_STYLES.map((s) => ( {s.label} diff --git a/client/src/pages/me/ui/sections/ProfileSection.tsx b/client/src/pages/me/ui/sections/ProfileSection.tsx index 01db0d8..c167299 100644 --- a/client/src/pages/me/ui/sections/ProfileSection.tsx +++ b/client/src/pages/me/ui/sections/ProfileSection.tsx @@ -1,3 +1,4 @@ +import { useEffect } from 'react' import Alert from '@mui/material/Alert' import Box from '@mui/material/Box' import Button from '@mui/material/Button' @@ -18,6 +19,10 @@ export function ProfileSection() { mode: 'onChange', }) + useEffect(() => { + profileForm.reset({ displayName: user?.displayName ? String(user.displayName) : '' }) + }, [user?.displayName, profileForm]) + return (