Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion apps/admin/src/routes/pages/Massmailer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
isClosable: true
});
});
}, []);

Check warning on line 137 in apps/admin/src/routes/pages/Massmailer.tsx

View workflow job for this annotation

GitHub Actions / verify (20.x)

React Hook useEffect has a missing dependency: 'toast'. Either include it or remove the dependency array

useEffect(() => {
api
Expand All @@ -149,12 +149,20 @@
isClosable: true
});
});
}, []);

Check warning on line 152 in apps/admin/src/routes/pages/Massmailer.tsx

View workflow job for this annotation

GitHub Actions / verify (20.x)

React Hook useEffect has a missing dependency: 'toast'. Either include it or remove the dependency array

const sendMassmail = (
values: EmailFormValues,
helpers: FormikHelpers<EmailFormValues>
) => {
if (
!window.confirm(
`Are you sure you want to send this ${values.isMobileNotification ? "notification" : "email"}?`
)
) {
helpers.setSubmitting(false);
return;
}
if (values.isMobileNotification) {
const notifData = {
title: values.subject,
Expand All @@ -164,6 +172,10 @@

const request = api
.post(path("/notifications/topics/:topic", { topic }), notifData)
.then(async () => {
helpers.resetForm();
await helpers.setFieldValue("isMobileNotification", true);
})
Comment thread
J164 marked this conversation as resolved.
.finally(() => helpers.setSubmitting(false));

toast.promise(request, {
Expand All @@ -182,6 +194,10 @@

const request = api
.post("/subscription/send-email/single", emailData)
.then(async () => {
helpers.resetForm();
await helpers.setFieldValue("isMobileNotification", false);
})
Comment thread
J164 marked this conversation as resolved.
.finally(() => helpers.setSubmitting(false));

toast.promise(request, {
Expand All @@ -199,6 +215,10 @@

const request = api
.post("/subscription/send-email", emailData)
.then(async () => {
helpers.resetForm();
await helpers.setFieldValue("isMobileNotification", false);
})
Comment thread
J164 marked this conversation as resolved.
.finally(() => helpers.setSubmitting(false));

toast.promise(request, {
Expand All @@ -208,7 +228,6 @@
});
return;
};

// note -- the markdown rendering for the preview takes place inside
// the <Formik /> component to interact with its values

Expand Down
Loading