fix: hide my pages menu for logged in users

This commit is contained in:
Christel Westerberg
2024-08-22 09:01:04 +02:00
parent fca9ee78b7
commit df076f50f5
2 changed files with 15 additions and 2 deletions

View File

@@ -0,0 +1,13 @@
import { serverClient } from "@/lib/trpc/server"
import MyPagesSidebar from "@/components/MyPages/Sidebar"
export async function MyPagesNavigation() {
const user = await serverClient().user.name()
// Check if we have user, that means we are logged in andt the My Pages menu can show.
if (!user) {
return null
}
return <MyPagesSidebar />
}

View File

@@ -1,7 +1,7 @@
import JsonToHtml from "@/components/JsonToHtml"
import SidebarMyPages from "@/components/MyPages/Sidebar"
import JoinLoyaltyContact from "./JoinLoyalty"
import { MyPagesNavigation } from "./MyPagesNavigation"
import styles from "./sidebar.module.css"
@@ -38,7 +38,7 @@ export default function SidebarLoyalty({ blocks }: SidebarProps) {
case SidebarTypenameEnum.LoyaltyPageSidebarDynamicContent:
switch (block.dynamic_content.component) {
case LoyaltySidebarDynamicComponentEnum.my_pages_navigation:
return <SidebarMyPages key={`${block.__typename}-${idx}`} />
return <MyPagesNavigation key={`${block.__typename}-${idx}`} />
default:
return null
}