import React, { useEffect } from 'react'; import { BrowserRouter as Router, Route, Routes, Link, useLocation, Outlet, Navigate } from 'react-router-dom'; // Added useLocation import { App } from './App'; import Cookies from 'js-cookie'; import LoginButton from './authentication/LoginButton'; // Import the LoginButton component import { useAuth0 } from '@auth0/auth0-react'; export default function RouterPage() { useEffect(() => { // Fetch the userId from the Flask backend fetch('http://localhost:5000/callback', { method: 'GET', credentials: 'include', // Important for sending cookies across origins }) .then(response => response.json()) .then(data => { // Assuming the userId is returned in the data object const userId = data.userId; Cookies.set('userId', userId, { expires: 7 }); }) .catch((error) => console.error('Error:', error)); }, []); // These could be different components for your different pages const Title = ({ isAuthenticated }) => ( TasktasticTest Environment {isAuthenticated ? ( Logout ) : ( )} ); return (.