Save form after saving custom field

[MAILPOET-2592]
This commit is contained in:
Pavel Dohnal
2020-01-07 13:44:00 +01:00
committed by Rostislav Wolný
parent 8feb574623
commit bcb2f1f4d8
4 changed files with 13 additions and 13 deletions

View File

@@ -47,15 +47,18 @@ export default {
endpoint: 'customFields', endpoint: 'customFields',
action: 'save', action: 'save',
data: requestData, data: requestData,
}).done((response) => { })
dispatch('mailpoet-form-editor').saveCustomFieldDone(customField.id, response.data); .then((response) => {
if (typeof actionData.onFinish === 'function') actionData.onFinish(); dispatch('mailpoet-form-editor').saveCustomFieldDone(customField.id, response.data);
}).fail((response) => { if (typeof actionData.onFinish === 'function') actionData.onFinish();
let errorMessage = null; })
if (response.errors.length > 0) { .then(dispatch('mailpoet-form-editor').saveForm)
errorMessage = response.errors.map((error) => (error.message)); .fail((response) => {
} let errorMessage = null;
dispatch('mailpoet-form-editor').saveCustomFieldFailed(errorMessage); if (response.errors.length > 0) {
}); errorMessage = response.errors.map((error) => (error.message));
}
dispatch('mailpoet-form-editor').saveCustomFieldFailed(errorMessage);
});
}, },
}; };

View File

@@ -19,7 +19,6 @@ export default (state, action) => {
return { return {
...state, ...state,
isCustomFieldSaving: false, isCustomFieldSaving: false,
isFormSaving: false,
notices, notices,
customFields, customFields,
}; };

View File

@@ -8,7 +8,6 @@ export default (state, action) => {
}); });
return { return {
...state, ...state,
isFormSaving: false,
isCustomFieldSaving: false, isCustomFieldSaving: false,
notices, notices,
}; };

View File

@@ -2,7 +2,6 @@ export default (state) => {
const notices = state.notices.filter((notice) => notice.id !== 'custom-field'); const notices = state.notices.filter((notice) => notice.id !== 'custom-field');
return { return {
...state, ...state,
isFormSaving: true,
isCustomFieldSaving: true, isCustomFieldSaving: true,
notices, notices,
}; };