feat: loosen up the zod validations and return null instead of throwing
This commit is contained in:
@@ -19,6 +19,9 @@ async function DynamicComponentBlock({ component }: DynamicComponentProps) {
|
||||
const session = await auth()
|
||||
|
||||
const user = session ? await serverClient().user.get() : null
|
||||
if (!user) {
|
||||
return null
|
||||
}
|
||||
|
||||
switch (component) {
|
||||
case LoyaltyComponentEnum.how_it_works:
|
||||
|
||||
@@ -10,6 +10,9 @@ import type { ContactRowProps } from "@/types/components/loyalty/sidebar"
|
||||
|
||||
export default async function ContactRow({ contact }: ContactRowProps) {
|
||||
const data = await serverClient().contentstack.base.contact()
|
||||
if (!data) {
|
||||
return null
|
||||
}
|
||||
|
||||
const val = getValueFromContactConfig(contact.contact_field, data)
|
||||
|
||||
|
||||
@@ -30,15 +30,19 @@ export default async function JoinLoyaltyContact({
|
||||
{block.preamble ? (
|
||||
<Body textAlign="center">{block.preamble}</Body>
|
||||
) : null}
|
||||
<Button asChild className={styles.link} intent="primary">
|
||||
<Link href="#">{formatMessage({ id: "Join Scandic Friends" })}</Link>
|
||||
<Button asChild intent="primary">
|
||||
<Body asChild fontOnly textAlign="center" textTransform="bold">
|
||||
<Link href={login[lang]}>
|
||||
{formatMessage({ id: "Join Scandic Friends" })}
|
||||
</Link>
|
||||
</Body>
|
||||
</Button>
|
||||
<Link href={login[lang]}>
|
||||
<Footnote textAlign="center" textTransform="bold">
|
||||
<Footnote asChild fontOnly textAlign="center" textTransform="bold">
|
||||
<Link color="burgundy" href={`/${lang}/login`}>
|
||||
{formatMessage({ id: "Already a friend?" })} <br />
|
||||
{formatMessage({ id: "Click here to log in" })}
|
||||
</Footnote>
|
||||
</Link>
|
||||
</Link>
|
||||
</Footnote>
|
||||
</article>
|
||||
{block.contact ? <Contact contactBlock={block.contact} /> : null}
|
||||
</section>
|
||||
|
||||
@@ -10,12 +10,3 @@
|
||||
gap: var(--Spacing-x5);
|
||||
padding: var(--Spacing-x4) var(--Spacing-x2) var(--Spacing-x5);
|
||||
}
|
||||
|
||||
/* TODO: Remove when we get proper button variables */
|
||||
.link {
|
||||
font-family: var(--typography-Body-Bold-fontFamily);
|
||||
font-size: var(--typography-Body-Bold-fontSize);
|
||||
font-weight: var(--typography-Body-Bold-fontWeight);
|
||||
letter-spacing: var(--typography-Body-Bold-letterSpacing);
|
||||
line-height: var(--typography-Body-Bold-lineHeight);
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ export default function SidebarLoyalty({
|
||||
return (
|
||||
<JoinLoyaltyContact
|
||||
block={block.join_loyalty_contact}
|
||||
key={`${block.__typename}-${idx}`}
|
||||
lang={lang}
|
||||
key={`${block.join_loyalty_contact.title}-${idx}`}
|
||||
/>
|
||||
)
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user