Skip to content

Commit

Permalink
Username shown only when a user logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
sergesoroka committed Sep 21, 2024
1 parent c9e2efc commit 4da38e0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions components/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@ export default function Header() {


const logoutHandle = () => {

localStorage.removeItem("username")
setIsAuthenticated(false)
}


const username = localStorage.getItem("username");

return (
<div className="logo">
<h1 onClick={() => navigate("/")}>Raman spectra search</h1>
<div className="usersInfo">
<div className="username">{localStorage.getItem("username")}</div>
<div className="username">{username}</div>
{keycloak.authenticated ?
<button className="shareBtn" onClick={() => {
keycloak.logout()
Expand Down

0 comments on commit 4da38e0

Please sign in to comment.