Skip to content

Commit

Permalink
Check for undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat Saxena committed Oct 30, 2024
1 parent 98487d1 commit a17ce95
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions apps/web/app/dashboard4/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,25 @@ export default async function Layout({
);
}

const formatSiteInfo = (siteinfo: SiteInfo) => ({
title: siteinfo.title || defaultState.siteinfo.title,
subtitle: siteinfo.subtitle || defaultState.siteinfo.subtitle,
logo: siteinfo.logo || defaultState.siteinfo.logo,
const formatSiteInfo = (siteinfo?: SiteInfo) => ({
title: siteinfo?.title || defaultState.siteinfo.title,
subtitle: siteinfo?.subtitle || defaultState.siteinfo.subtitle,
logo: siteinfo?.logo || defaultState.siteinfo.logo,
currencyISOCode:
siteinfo.currencyISOCode || defaultState.siteinfo.currencyISOCode,
siteinfo?.currencyISOCode || defaultState.siteinfo.currencyISOCode,
paymentMethod:
siteinfo.paymentMethod || defaultState.siteinfo.paymentMethod,
stripeKey: siteinfo.stripeKey || defaultState.siteinfo.stripeKey,
codeInjectionHead: siteinfo.codeInjectionHead
siteinfo?.paymentMethod || defaultState.siteinfo.paymentMethod,
stripeKey: siteinfo?.stripeKey || defaultState.siteinfo.stripeKey,
codeInjectionHead: siteinfo?.codeInjectionHead
? decode(siteinfo.codeInjectionHead)
: defaultState.siteinfo.codeInjectionHead,
codeInjectionBody: siteinfo.codeInjectionBody
codeInjectionBody: siteinfo?.codeInjectionBody
? decode(siteinfo.codeInjectionBody)
: defaultState.siteinfo.codeInjectionBody,
mailingAddress:
siteinfo.mailingAddress || defaultState.siteinfo.mailingAddress,
siteinfo?.mailingAddress || defaultState.siteinfo.mailingAddress,
hideCourseLitBranding:
siteinfo.hideCourseLitBranding ||
siteinfo?.hideCourseLitBranding ||
defaultState.siteinfo.hideCourseLitBranding,
razorpayKey: siteinfo.razorpayKey || defaultState.siteinfo.razorpayKey,
razorpayKey: siteinfo?.razorpayKey || defaultState.siteinfo.razorpayKey,
});

0 comments on commit a17ce95

Please sign in to comment.