Skip to content

Commit

Permalink
feat: support newsletterId for InputCTASection
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhojang6 committed Jan 31, 2025
1 parent 8a52a40 commit afbfdc1
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type InputCTASectionProps = {
linkProps?: Props
formInput?: any[]
buType?: buType
newsletterId?: number
}

type buType = 'codex' | 'waku' | 'nomos'
Expand All @@ -24,6 +25,7 @@ export const InputCTASection: React.FC<InputCTASectionProps & Props> = ({
linkProps,
formInput,
buType,
newsletterId = null,
}) => {
const [formState, setFormState] = React.useState({ email: '', name: '' })
const [message, setMessage] = React.useState('')
Expand All @@ -49,11 +51,19 @@ export const InputCTASection: React.FC<InputCTASectionProps & Props> = ({
body: JSON.stringify({
jsonrpc: '2.0',
method: 'call',
params: {
email: formState?.email,
type: buType,
subscription_type: 'email',
},
params:
newsletterId == null
? {
email: formState?.email,
type: buType,
subscription_type: 'email',
}
: {
email: formState?.email,
type: buType,
subscription_type: 'email',
newsletterId: newsletterId,
},
}),
},
)
Expand Down

0 comments on commit afbfdc1

Please sign in to comment.