J'utilise le template Dashboard de material ui et j'ai ajouté une page de connexion. Quand je rentre http://localhost:3000, je suis bien redirigé vers http://localhost:3000/login

Mais quand je clique dans mon menu pour atteindre la page profil (http://localhost:3000/use), je suis de nouveau redirigé vers la page de connexion (http://localhost:3000/login).

Je ne comprends pas le problème.

Mon fichier(dossier) principal de parcours(routes) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import Login from "views/authentification/LoginPage.jsx";
import Dashboard from "layouts/Dashboard/Dashboard.jsx";
 
const indexRoutes = [
{ 
    path: "/login", 
    component: Login
},
{ 
    path: "/dashboard", 
    component: Dashboard 
},
{ 
    redirect: true, 
    path: "/", 
    to: "/login"
}
];
 
export default indexRoutes;
Mon fichier de route Dahboard :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// @material-ui/icons
import Dashboard from "@material-ui/icons/Dashboard";
import Person from "@material-ui/icons/Person";
// import ContentPaste from "@material-ui/icons/ContentPaste";
import LibraryBooks from "@material-ui/icons/LibraryBooks";
import BubbleChart from "@material-ui/icons/BubbleChart";
import LocationOn from "@material-ui/icons/LocationOn";
import Notifications from "@material-ui/icons/Notifications";
import Unarchive from "@material-ui/icons/Unarchive";
// core components/views
import DashboardPage from "views/Dashboard/Dashboard.jsx";
import UserProfile from "views/UserProfile/UserProfile.jsx";
import TableList from "views/TableList/TableList.jsx";
import Typography from "views/Typography/Typography.jsx";
import Icons from "views/Icons/Icons.jsx";
import Maps from "views/Maps/Maps.jsx";
import NotificationsPage from "views/Notifications/Notifications.jsx";
import UpgradeToPro from "views/UpgradeToPro/UpgradeToPro.jsx";
 
const dashboardRoutes = [
{
path: "/dashboard",
sidebarName: "Dashboard",
navbarName: "Material Dashboard",
icon: Dashboard,
component: DashboardPage
},
{ 
path: "/user",
exact: true,
sidebarName: "User Profile",
navbarName: "Profile",
icon: Person,
component: UserProfile
},
{
path: "/table",
sidebarName: "Table List",
navbarName: "Table List",
icon: "content_paste",
component: TableList
},
..........
];
 
export default dashboardRoutes;