Skip to content

Commit

Permalink
default last name to MISSING -- breaks further down if empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
ptbarnum4 committed Oct 9, 2024
1 parent 3f4deb7 commit 29afd86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/helpers/facebookWebhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export const formatFacebookPayload = async (
const session = findBestSession(sessions, fields.time);
const [fullFirstName, ...names] = fields.name.split(' ');
const firstName = stripSpecialChars(fullFirstName);
const lastName = stripSpecialChars(names.pop() ?? '');
const lastName = stripSpecialChars(names.filter(Boolean).pop() ?? '') || 'MISSING';
const zipCode = fields.zip?.replaceAll(/\D/g, '') || '70117';
const state = getStateFromZipCode(Number(zipCode)) ?? 'No State';
const phone = parsePhoneNumber(fields.phone) || '555-555-5555';
Expand Down

0 comments on commit 29afd86

Please sign in to comment.