File tree Expand file tree Collapse file tree 2 files changed +45
-2
lines changed
Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 1+ import React , { useEffect , useState } from 'react'
2+ import { Link , useNavigate } from 'react-router-dom' ;
3+ import secureLocalStorage from "react-secure-storage"
4+
5+ const Dashboard = ( ) => {
6+ const navigate = useNavigate ( )
7+ const RoleUser = secureLocalStorage . getItem ( "Login1" ) ;
8+ const EmailUser = secureLocalStorage . getItem ( "login2" ) ;
9+
10+ const logout = ( ) => {
11+ localStorage . clear ( )
12+ navigate ( '/' )
13+ window . location . reload ( ) ;
14+ }
15+
16+ if ( RoleUser !== null && EmailUser !== null ) {
17+ return (
18+ < div className = 'bg-gray-200 py-8 px-12' >
19+ < div className = "bg-white rounded py-8 px-4" >
20+ < h1 className = "text-gray-500 font-semibold text-2xl" > Welcome to Dashboard</ h1 >
21+ < hr />
22+
23+ < div className = "my-4 mx-8" >
24+ < p className = "text-xl text-gray-500" > Email : { EmailUser } </ p >
25+ < p className = "text-xl text-gray-500" > Role: { RoleUser } </ p >
26+ </ div >
27+ < button onClick = { logout } className = "bg-red-500 text-white rounded py-2 px-4 shadow-md duration-500 hover:bg-red-600 font-semibold" > Logout</ button >
28+ </ div >
29+ </ div >
30+ )
31+ }
32+ else {
33+ useEffect ( ( ) => {
34+ localStorage . clear ( )
35+ navigate ( '/' )
36+ } )
37+ }
38+ }
39+
40+ export default Dashboard
Original file line number Diff line number Diff line change @@ -11,12 +11,15 @@ const destinationApp = argv.destination || path.join(process.cwd(), 'src/');
1111const sourceTW = argv . source || path . join ( __dirname , 'LoginSignUpTW' ) ;
1212const destinationTW = argv . destination || path . join ( process . cwd ( ) , 'src/components/LoginSignUpTW' ) ;
1313
14- const sourceAppTW = argv . source || path . join ( __dirname , 'AppTW/App.jsx ' ) ;
14+ const sourceAppTW = argv . source || path . join ( __dirname , 'AppTW' ) ;
1515const destinationAppTW = argv . destination || path . join ( process . cwd ( ) , 'src/' ) ;
1616
17- const sourcePR = argv . source || path . join ( __dirname , 'PrivateRoute/PrivateRoute.jsx ' ) ;
17+ const sourcePR = argv . source || path . join ( __dirname , 'PrivateRoute' ) ;
1818const destinationPR = argv . destination || path . join ( process . cwd ( ) , 'src/components/PrivateRoute' ) ;
1919
20+ const sourceDash = argv . source || path . join ( __dirname , 'PrivateRoute' ) ;
21+ const destinationDash = argv . destination || path . join ( process . cwd ( ) , 'src/components/PrivateRoute' ) ;
22+
2023const sourceBackendMysqlNoMVC = argv . source || path . join ( __dirname , 'BackEndMysqlNoMVC/server' ) ;
2124const destinationBackendMysqlNoMVC = argv . destination || path . join ( process . cwd ( ) , 'server/' ) ;
2225
You can’t perform that action at this time.
0 commit comments