Skip to content

Commit d6c3a02

Browse files
committed
fix: typo in action
1 parent c34fa5f commit d6c3a02

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/components/subscribe/_actions/subscribe.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ export const subscribe = async (
5757

5858
const errors = response.data.newsletter.subscribe.errors;
5959

60-
const subcriberAlreadyExists = errors.some(
60+
// If subscriber already exists, treat it as success for privacy reasons
61+
// We don't want to reveal that the email is already subscribed
62+
const subscriberAlreadyExists = errors.some(
6163
({ __typename }) => __typename === 'CreateSubscriberAlreadyExistsError',
6264
);
6365

64-
// If subscriber already exists, we want to reset the form and show the success message as if this was the first time they subscribed
65-
// This is for privacy reasons, we don't want to show the error message to the user if they are already subscribed
66-
if (subcriberAlreadyExists) {
66+
if (subscriberAlreadyExists) {
6767
return {
6868
lastResult: submission.reply(),
6969
successMessage: t('subscribedToNewsletter'),
@@ -87,6 +87,7 @@ export const subscribe = async (
8787
};
8888
}
8989

90+
// If there are no errors, we want to show the success message to the user
9091
return {
9192
lastResult: submission.reply(),
9293
successMessage: t('subscribedToNewsletter'),

0 commit comments

Comments
 (0)