Skip to content

Commit 09ff16f

Browse files
committed
chore: add no nsid state
1 parent 123b4f1 commit 09ff16f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

web/src/components/nav-bar/nav-bar.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,23 @@ import {
55
NavbarItem
66
} from "@nextui-org/react";
77
import { Button } from "@nextui-org/react";
8+
import { useEffect, useState } from "react";
89

910
export default function Nav() {
11+
12+
const [nsid, setNSID] = useState('');
13+
14+
useEffect(() => {
15+
setNSID(localStorage.getItem('nsid') ?? '');
16+
}, [])
17+
1018
return (
1119
<Navbar position="static" isBordered className="bg-[#D4D4D4]">
1220
<NavbarBrand>
1321
<p className="font-bold text-inherit text-slate-900">STARR Lab Rad-Effects Database</p>
1422
</NavbarBrand>
1523
<NavbarContent justify="end">
16-
<span>Logged in as: { localStorage.getItem('nsid') }</span>
24+
{ nsid ? (<span>Logged in as: { nsid }</span>) : (<span>Currently not logged in</span>)}
1725
<NavbarItem>
1826
<Button className="bg-usask-green" variant="flat">
1927
<span className="text-slate-50">Log out</span>

0 commit comments

Comments
 (0)