diff --git a/frontend/src/pages/Admin/Auth/Login/index.tsx b/frontend/src/pages/Admin/Auth/Login/index.tsx index b40f8ec..dc0a998 100644 --- a/frontend/src/pages/Admin/Auth/Login/index.tsx +++ b/frontend/src/pages/Admin/Auth/Login/index.tsx @@ -1,4 +1,4 @@ -import { Link } from 'react-router-dom'; +import { Link, useHistory } from 'react-router-dom'; import ButtonIcon from 'components/ButtonIcon'; import { useForm } from 'react-hook-form'; import './styles.css'; @@ -13,6 +13,7 @@ type FormData = { const Login = () => { const [hasError, setHasError] = useState(false); const { register, handleSubmit, formState: {errors} } = useForm(); + const history = useHistory(); const onSubmit = (formData: FormData) => { requestBackendLogin(formData) .then((response) => { @@ -21,6 +22,7 @@ const Login = () => { console.log('TOKEN gerado: ' + token) setHasError(false); console.log('SUCESSO', response); + history.push('/admin'); }) .catch((error) => { setHasError(true);