I have 2 problems.
- I want it to automatically redirect to /signin page when I start the project.
- I want to prevent someone who is not logged in from accessing the homepage.
I am using aws amplify for authentication and know there is no problem. I have no problem logging in.
I want to use something like this Auth.currentSession ? (navigate = "/homepage") : (navigate = "/signin") Can you help me?
App.js
function App() {
const ref = useRef(null);
const navigate = useNavigate();
return (
<BrowserRouter>
<Routes>
<Route path="/signin" element={<SignIn />}></Route>
<Route path="/signup" element={<SignUp />}></Route>
<Route path="/homepage" element={<HomePage />}></Route>
</Routes>
</BrowserRouter>
);
}