import { store } from '../redux'; import { useState } from "react"; import { Link, Redirect, useHistory } from "react-router-dom"; import { actionFullLogin } from "../redux/action"; import { Paper, Box, Typography, Button, Stack, OutlinedInput, IconButton, InputLabel, InputAdornment, FormControl } from "@mui/material"; import { Visibility, VisibilityOff } from '@mui/icons-material'; // поля логин/пароль/кнопка входа const LoginForm = ({ onLogin }) => { // отслеживаем введение данных в полях логин/пароль const [login, setLogin] = useState('') const [pass, setPass] = useState('') // включаем,выклюаем отображение пароля const [showPassword, setShowPassword] = useState(false); const handleClickShowPassword = () => setShowPassword((show) => !show); const handleMouseDownPassword = (event) => { event.preventDefault(); }; return ( Имя пользователя setLogin(e.target.value)} /> Пароль setPass(e.target.value)} endAdornment={ {showPassword ? : } } /> ) } // Вся страница формы export default function Authorization() { const history = useHistory(); return ( Hipstagram { await store.dispatch(actionFullLogin(login, pass)) if ((Object.keys(store.getState().auth)).length) { history.push('/') } }} /> Зарегистрироваться ) }