Skip to content

Commit

Permalink
Made some changes to fix build in CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
Meefish committed Nov 28, 2024
1 parent 8803b49 commit c0e603c
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 12 deletions.
27 changes: 24 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
]
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@types/http-proxy-middleware": "^0.19.3",
"@types/jest": "^29.5.14",
"@types/testing-library__jest-dom": "^5.14.8",
Expand Down
42 changes: 33 additions & 9 deletions src/pages/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,48 @@ const Profile: React.FC = () => {
}, []);

const handleLogout = () => {
localStorage.removeItem('authToken'); // Remove the token from local storage
navigate('/login'); // Redirect to the login page
localStorage.removeItem('authToken');
navigate('/login');
};

if (isLoading) {
return (
<div className="profile-page">
<Navbar />
<div className="profile-content">
<div>Loading...</div>
</div>
</div>
);
}

if (error) {
return (
<div className="profile-page">
<Navbar />
<div className="profile-content">
<div>{error}</div>
</div>
</div>
);
}

return (
<div className="profile-page">
{/* Navbar */}
<Navbar />

{/* Profile Content */}
<div className="profile-content">
{user && (
<div className="profile-info">
<h2>Profile</h2>
<p><strong>Name:</strong> {user.name}</p>
<p><strong>Email:</strong> {user.email}</p>
<p><strong>Role:</strong> {user.roles[0]?.name || 'N/A'}</p>

<p>
<strong>Name:</strong> {user.name}
</p>
<p>
<strong>Email:</strong> {user.email}
</p>
<p>
<strong>Role:</strong> {user.roles[0]?.name || 'N/A'}
</p>
<button className="logout-button" onClick={handleLogout}>
Logout
</button>
Expand Down

0 comments on commit c0e603c

Please sign in to comment.