diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 465ab13..4915bd3 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -1,7 +1,7 @@ import { IonContent, IonPage, IonToast } from '@ionic/react'; import { Color } from '@ionic/core'; import { useContext, useEffect, useState } from 'react'; -import { useLocation } from 'react-router'; +import { useHistory, useLocation } from 'react-router'; import { UserContext } from '../App'; @@ -17,6 +17,7 @@ interface LocationState { const Home: React.FC = () => { const location = useLocation(); + const history = useHistory(); const user = useContext(UserContext); @@ -41,6 +42,7 @@ const Home: React.FC = () => { // setMessageToast(response.message); // setShowToast(true); + history.push(`/login`) return } @@ -52,6 +54,7 @@ const Home: React.FC = () => { // if (error.response.data.message) { console.dir('Houve um erro: ', { error }) alert('Houve um erro') + history.push(`/login`) }) }