diff --git a/src/form/fragmentUtil.ts b/src/form/fragmentUtil.ts index ea1f8d9c..d95fd1ea 100644 --- a/src/form/fragmentUtil.ts +++ b/src/form/fragmentUtil.ts @@ -5,7 +5,7 @@ import { AdSetFragment } from "graphql/ad-set.generated"; export function createCampaignFromFragment( data: CampaignFragment, - userId: string, + userId?: string, ): CreateCampaignInput { const adSets: CreateAdSetInput[] = data.adSets.map((adSet) => createAdSetFromFragment(adSet), diff --git a/src/user/User.tsx b/src/user/User.tsx index 5da66d6f..41ff4d2e 100644 --- a/src/user/User.tsx +++ b/src/user/User.tsx @@ -51,19 +51,13 @@ export function User() { a.selfServiceCreate} /> a.selfServiceEdit} /> boolean; } const ProtectedRoute = ({ authedComponent, unauthedComponent, path, - validateAdvertiserProperty, + validateAdvertiserProperty = () => true, }: ProtectedProps) => { const { advertiser } = useAdvertiser(); @@ -116,10 +110,7 @@ const ProtectedRoute = ({ return ; } - if ( - validateAdvertiserProperty && - advertiser[validateAdvertiserProperty.key] != validateAdvertiserProperty.val - ) { + if (!validateAdvertiserProperty(advertiser)) { return ; }