Skip to content

Commit 7688fa2

Browse files
Fix mailchimp submissions (#922)
* remove check for optional listId as function to resolve listID will return new one if not found * changeset
1 parent 8609771 commit 7688fa2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.changeset/free-mice-switch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/integration-mailchimp': minor
3+
---
4+
5+
Updates check to look for listID as function returns out before it can find a list to subscribe to

integrations/mailchimp/src/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,12 @@ const mailchimpSubscribe = createComponent<
6565
if (!accessToken) {
6666
throw new ExposableError('Mailchimp integration not configured');
6767
}
68-
if (!element.props.listId) {
69-
throw new ExposableError('No list ID provided');
70-
}
7168

7269
try {
7370
const listId = await resolveMailingListId(
74-
element.props.listId,
7571
configuration.api_endpoint,
7672
accessToken,
73+
element.props.listId,
7774
);
7875

7976
if (!listId) {
@@ -166,9 +163,9 @@ const mailchimpSubscribe = createComponent<
166163
});
167164

168165
async function resolveMailingListId(
169-
propListId: string,
170166
apiEndpoint: string,
171167
accessToken: string,
168+
propListId?: string,
172169
): Promise<string | undefined> {
173170
if (propListId) {
174171
return propListId;

0 commit comments

Comments
 (0)