From cd73faaff745b2905f94545d7e64fef4b95b4e19 Mon Sep 17 00:00:00 2001 From: Amine Ben hammou Date: Fri, 17 Apr 2020 14:03:33 +0200 Subject: [PATCH] Show loader on cancel [MAILPOET-2693] --- .../src/settings/pages/send_with/other/activate_or_cancel.tsx | 3 +++ assets/js/src/settings/store/actions.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/assets/js/src/settings/pages/send_with/other/activate_or_cancel.tsx b/assets/js/src/settings/pages/send_with/other/activate_or_cancel.tsx index 54d854936d..a89fd7dafa 100644 --- a/assets/js/src/settings/pages/send_with/other/activate_or_cancel.tsx +++ b/assets/js/src/settings/pages/send_with/other/activate_or_cancel.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; +import MailPoet from 'mailpoet'; import { t } from 'common/functions'; import { useAction } from 'settings/store/hooks'; @@ -14,8 +15,10 @@ export default function ActivateOrCancel() { }; const cancel = async (e) => { e.preventDefault(); + MailPoet.Modal.loading(true); await loadSettings(); history.push('/mta'); + MailPoet.Modal.loading(false); }; return (

diff --git a/assets/js/src/settings/store/actions.ts b/assets/js/src/settings/store/actions.ts index 211c35d23f..44d9e9a022 100644 --- a/assets/js/src/settings/store/actions.ts +++ b/assets/js/src/settings/store/actions.ts @@ -206,6 +206,9 @@ export function* reinstall() { } export function* sendTestEmail(recipient: string, mailer: Settings['mta']) { + if (!recipient) { + return { type: 'TEST_EMAIL_FAILED', error: [t('cantSendEmail')] }; + } yield { type: 'START_TEST_EMAIL_SENDING' }; const res = yield { type: 'CALL_API',