Skip to content

Commit 89ffa89

Browse files
BackendExpertJehanKandyAnupa1998
committed
Update
Co-Authored-By: JehanKandy <jehankandy@gmail.com> Co-Authored-By: Anupa Gamage <125038143+Anupa1998@users.noreply.github.com>
1 parent f3720c2 commit 89ffa89

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

Dashboard/Dashboard.jsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ const destinationApp = argv.destination || path.join(process.cwd(), 'src/');
1111
const sourceTW = argv.source || path.join(__dirname, 'LoginSignUpTW');
1212
const 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');
1515
const 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');
1818
const 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+
2023
const sourceBackendMysqlNoMVC = argv.source || path.join(__dirname, 'BackEndMysqlNoMVC/server');
2124
const destinationBackendMysqlNoMVC = argv.destination || path.join(process.cwd(), 'server/');
2225

0 commit comments

Comments
 (0)