Hide transactions button if not logged in
This commit is contained in:
@ -17,7 +17,7 @@ type NavBarLayoutProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const NavBarLayout = ({ children }: NavBarLayoutProps) => {
|
const NavBarLayout = ({ children }: NavBarLayoutProps) => {
|
||||||
const { hasRole } = useAuth()
|
const { hasRole, isAuthenticated } = useAuth()
|
||||||
const [basket] = useState(getBasket())
|
const [basket] = useState(getBasket())
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -40,6 +40,7 @@ const NavBarLayout = ({ children }: NavBarLayoutProps) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="ml-auto justify-end space-x-3">
|
<div className="ml-auto justify-end space-x-3">
|
||||||
<ul className="relative hidden items-center space-x-3 lg:flex">
|
<ul className="relative hidden items-center space-x-3 lg:flex">
|
||||||
|
{isAuthenticated ? (
|
||||||
<li>
|
<li>
|
||||||
<Link
|
<Link
|
||||||
to={routes.userTransactions()}
|
to={routes.userTransactions()}
|
||||||
@ -48,6 +49,9 @@ const NavBarLayout = ({ children }: NavBarLayoutProps) => {
|
|||||||
Transactions
|
Transactions
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
<ThemeToggle />
|
<ThemeToggle />
|
||||||
<Link
|
<Link
|
||||||
@ -114,6 +118,7 @@ const NavBarLayout = ({ children }: NavBarLayoutProps) => {
|
|||||||
<p className="font-inter text-base">Basket</p>
|
<p className="font-inter text-base">Basket</p>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
|
{isAuthenticated ? (
|
||||||
<li>
|
<li>
|
||||||
<Link
|
<Link
|
||||||
to={routes.userTransactions()}
|
to={routes.userTransactions()}
|
||||||
@ -122,6 +127,9 @@ const NavBarLayout = ({ children }: NavBarLayoutProps) => {
|
|||||||
<p className="font-inter text-base">Transactions</p>
|
<p className="font-inter text-base">Transactions</p>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user