Add error notice when email saving fails
[MAILPOET-5660]
This commit is contained in:
committed by
Jan Lysý
parent
c390e860ed
commit
aeaadf7cab
@@ -59,17 +59,30 @@ export const closeSidebar =
|
|||||||
export function* saveEditedEmail() {
|
export function* saveEditedEmail() {
|
||||||
const postId = select(storeName).getEmailPostId();
|
const postId = select(storeName).getEmailPostId();
|
||||||
// This returns a promise
|
// This returns a promise
|
||||||
yield dispatch(coreDataStore).saveEditedEntityRecord(
|
|
||||||
|
const result = yield dispatch(coreDataStore).saveEditedEntityRecord(
|
||||||
'postType',
|
'postType',
|
||||||
'mailpoet_email',
|
'mailpoet_email',
|
||||||
postId,
|
postId,
|
||||||
{},
|
{ throwOnError: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
return dispatch(noticesStore).createSuccessNotice(
|
result.then(() => {
|
||||||
__('Email saved!', 'mailpoet'),
|
dispatch(noticesStore).createErrorNotice(__('Email saved!', 'mailpoet'), {
|
||||||
{ type: 'snackbar', isDismissible: true },
|
type: 'snackbar',
|
||||||
|
isDismissible: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
result.catch(() => {
|
||||||
|
dispatch(noticesStore).createErrorNotice(
|
||||||
|
__('There was an error saving email!', 'mailpoet'),
|
||||||
|
{
|
||||||
|
type: 'default',
|
||||||
|
isDismissible: true,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* updateEmailProperty(name: string, subject: string) {
|
export function* updateEmailProperty(name: string, subject: string) {
|
||||||
|
Reference in New Issue
Block a user