chore: move user fetch
This commit is contained in:
@@ -16,7 +16,9 @@ import type {
|
|||||||
} from "@/types/components/loyalty/blocks"
|
} from "@/types/components/loyalty/blocks"
|
||||||
import { LoyaltyComponentEnum } from "@/types/components/loyalty/enums"
|
import { LoyaltyComponentEnum } from "@/types/components/loyalty/enums"
|
||||||
|
|
||||||
function DynamicComponentBlock({ component, user }: DynamicComponentProps) {
|
async function DynamicComponentBlock({ component }: DynamicComponentProps) {
|
||||||
|
const user = await serverClient().user.get()
|
||||||
|
|
||||||
switch (component) {
|
switch (component) {
|
||||||
case LoyaltyComponentEnum.how_it_works:
|
case LoyaltyComponentEnum.how_it_works:
|
||||||
return <HowItWorks />
|
return <HowItWorks />
|
||||||
@@ -29,7 +31,7 @@ function DynamicComponentBlock({ component, user }: DynamicComponentProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function DynamicContent({
|
export default function DynamicContent({
|
||||||
dynamicContent,
|
dynamicContent,
|
||||||
}: DynamicContentProps) {
|
}: DynamicContentProps) {
|
||||||
const displayHeader = !!(
|
const displayHeader = !!(
|
||||||
@@ -37,7 +39,6 @@ export default async function DynamicContent({
|
|||||||
dynamicContent.subtitle ||
|
dynamicContent.subtitle ||
|
||||||
dynamicContent.title
|
dynamicContent.title
|
||||||
)
|
)
|
||||||
const user = await serverClient().user.get()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className={styles.container}>
|
<section className={styles.container}>
|
||||||
@@ -56,14 +57,7 @@ export default async function DynamicContent({
|
|||||||
</Subtitle>
|
</Subtitle>
|
||||||
</header>
|
</header>
|
||||||
) : null}
|
) : null}
|
||||||
{dynamicContent.component === LoyaltyComponentEnum.overview_table ? (
|
<DynamicComponentBlock component={dynamicContent.component} />
|
||||||
<DynamicComponentBlock
|
|
||||||
component={dynamicContent.component}
|
|
||||||
user={user}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<DynamicComponentBlock component={dynamicContent.component} />
|
|
||||||
)}
|
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import CardsGrid from "./CardsGrid"
|
|||||||
import type { BlocksProps } from "@/types/components/loyalty/blocks"
|
import type { BlocksProps } from "@/types/components/loyalty/blocks"
|
||||||
import { LoyaltyBlocksTypenameEnum } from "@/types/components/loyalty/enums"
|
import { LoyaltyBlocksTypenameEnum } from "@/types/components/loyalty/enums"
|
||||||
|
|
||||||
export async function Blocks({ blocks }: BlocksProps) {
|
export function Blocks({ blocks }: BlocksProps) {
|
||||||
return blocks.map((block) => {
|
return blocks.map((block) => {
|
||||||
switch (block.__typename) {
|
switch (block.__typename) {
|
||||||
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksContent:
|
case LoyaltyBlocksTypenameEnum.LoyaltyPageBlocksContent:
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ export type DynamicContentProps = {
|
|||||||
|
|
||||||
export type DynamicComponentProps = {
|
export type DynamicComponentProps = {
|
||||||
component: DynamicContent["dynamic_content"]["component"]
|
component: DynamicContent["dynamic_content"]["component"]
|
||||||
user?: User
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CardsGridProps = Pick<CardsGrid, "cards_grid">
|
export type CardsGridProps = Pick<CardsGrid, "cards_grid">
|
||||||
|
|||||||
Reference in New Issue
Block a user