Skip to content

Commit

Permalink
Merge pull request #29 from calebwharton/minor-fixes
Browse files Browse the repository at this point in the history
fix logout on nav
  • Loading branch information
oorjagandhi authored Jul 13, 2024
2 parents 62aecb5 + ce7220c commit 18d9256
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions web/src/components/NavBarProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "../styles/Navbar.css";

export default function NavBar() {
const navigate = useNavigate();
// utils/auth.ts

const getUserID = (): string | null => {
return localStorage.getItem("user_id");
};
Expand Down Expand Up @@ -35,15 +35,17 @@ export default function NavBar() {
<span className="menu-item text-offwhite text-lg">LEADERBOARD</span>
</Link>
</div>
<div>
<div className="flex items-center">
{isUserLoggedIn() && (
<Link to="/profile" className="text-offwhite menu-icon">
<LogoutIcon fontSize="large" />
</Link>
<>
<button onClick={handleLogOut} className="menu-icon">
<LogoutIcon fontSize="large" className="text-offwhite" />
</button>
<button onClick={handleLogOut} className="text-primary ml-2">
LOGOUT
</button>
</>
)}
<button onClick={handleLogOut} className="text-primary ml-2">
LOGOUT
</button>
</div>
</nav>
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface User {
points: number;
email: string;
phoneNumber: string;
eventsAttended: string[];
eventsAttended: { name: string; date: string; location: string }[];
eventsCreated: string[];
}
export default function Profile() {
Expand Down

0 comments on commit 18d9256

Please sign in to comment.