diff --git a/components/Loyalty/Blocks/DynamicContent/index.tsx b/components/Loyalty/Blocks/DynamicContent/index.tsx index 1fc74d547..283fd5819 100644 --- a/components/Loyalty/Blocks/DynamicContent/index.tsx +++ b/components/Loyalty/Blocks/DynamicContent/index.tsx @@ -1,5 +1,6 @@ import { serverClient } from "@/lib/trpc/server" +import { auth } from "@/auth" import Link from "@/components/TempDesignSystem/Link" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import Title from "@/components/TempDesignSystem/Text/Title" @@ -17,7 +18,9 @@ import type { import { LoyaltyComponentEnum } from "@/types/components/loyalty/enums" async function DynamicComponentBlock({ component }: DynamicComponentProps) { - const user = await serverClient().user.get() + const session = await auth() + + const user = session ? await serverClient().user.get() : null switch (component) { case LoyaltyComponentEnum.how_it_works: diff --git a/types/components/loyalty/blocks.ts b/types/components/loyalty/blocks.ts index 8e500d11c..9152ed42e 100644 --- a/types/components/loyalty/blocks.ts +++ b/types/components/loyalty/blocks.ts @@ -36,7 +36,7 @@ type OverviewTableTitleTranslation = { export type OverviewTableTitleProps = { texts: OverviewTableTitleTranslation[] } -export type OverviewTableProps = { user?: User } +export type OverviewTableProps = { user: User | null } export type Level = { tier: membershipLevels