diff --git a/src/pages/AccountPage/UserForm/UserForm.jsx b/src/pages/AccountPage/UserForm/UserForm.jsx
index 8f0b942..450d963 100644
--- a/src/pages/AccountPage/UserForm/UserForm.jsx
+++ b/src/pages/AccountPage/UserForm/UserForm.jsx
@@ -28,6 +28,7 @@ import { format } from 'date-fns';
import defaultAvatar from 'images/sprite.svg';
import { useDispatch, useSelector } from 'react-redux';
import {
+ selectIsLoading,
selectUserAvatarURL,
selectUserBirthday,
selectUserEmail,
@@ -45,6 +46,7 @@ import {
TELEGRAM_REGEX,
} from '../../../constants/joiRegex';
import { toast } from 'react-toastify';
+import { Loader } from 'components/Loader/Loader';
export const UserForm = () => {
const [image, setImage] = useState(null);
@@ -60,301 +62,303 @@ export const UserForm = () => {
const telegram = useSelector(selectUserTelegram);
const avatar = useSelector(selectUserAvatarURL);
const birthday = useSelector(selectUserBirthday) || Date.now();
+ const isLoading = useSelector(selectIsLoading);
const formattedDate = format(new Date(birthday), 'yyyy-MM-dd');
- const handleUpload = async event => {
- event.preventDefault();
- if (!setImage) {
- toast.error('Please select a file');
- return true;
- }
- };
+ // const handleUpload = async event => {
+ // console.log('handleUpload ');
+ // event.preventDefault();
+ // if (!setImage) {
+ // toast.error('Please select a file');
+ // return true;
+ // }
+ // };
const FILE_SIZE = 2 * 1024 * 1024;
const SUPPORTED_FORMATS = ['image/jpg', 'image/jpeg', 'image/png'];
return (
- {
- if (!value) {
- return true;
- }
- const isGoodSize = value?.size <= FILE_SIZE;
- if (!isGoodSize) {
- toast.error('File too large');
- }
- return isGoodSize;
- })
- .test('format', 'Unsupported Format', value => {
- if (!value) {
- return true;
- }
- const isSupportedFormat = SUPPORTED_FORMATS.includes(value.type);
- if (!isSupportedFormat) {
- toast.error('Unsupported format');
- }
- return isSupportedFormat;
- }),
- })}
- onSubmit={async (values, { setSubmitting }) => {
- await dispatch(userForm(values)).unwrap();
- setSubmitting(false);
- toast.success('Form submitted successfully');
- }}
- >
- {formik => (
-
- )}
-
+
+
+
+
+ )}
+
+ >
);
};