Save form after saving custom field
[MAILPOET-2592]
This commit is contained in:
committed by
Rostislav Wolný
parent
8feb574623
commit
bcb2f1f4d8
@@ -47,15 +47,18 @@ export default {
|
||||
endpoint: 'customFields',
|
||||
action: 'save',
|
||||
data: requestData,
|
||||
}).done((response) => {
|
||||
dispatch('mailpoet-form-editor').saveCustomFieldDone(customField.id, response.data);
|
||||
if (typeof actionData.onFinish === 'function') actionData.onFinish();
|
||||
}).fail((response) => {
|
||||
let errorMessage = null;
|
||||
if (response.errors.length > 0) {
|
||||
errorMessage = response.errors.map((error) => (error.message));
|
||||
}
|
||||
dispatch('mailpoet-form-editor').saveCustomFieldFailed(errorMessage);
|
||||
});
|
||||
})
|
||||
.then((response) => {
|
||||
dispatch('mailpoet-form-editor').saveCustomFieldDone(customField.id, response.data);
|
||||
if (typeof actionData.onFinish === 'function') actionData.onFinish();
|
||||
})
|
||||
.then(dispatch('mailpoet-form-editor').saveForm)
|
||||
.fail((response) => {
|
||||
let errorMessage = null;
|
||||
if (response.errors.length > 0) {
|
||||
errorMessage = response.errors.map((error) => (error.message));
|
||||
}
|
||||
dispatch('mailpoet-form-editor').saveCustomFieldFailed(errorMessage);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
@@ -19,7 +19,6 @@ export default (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
isCustomFieldSaving: false,
|
||||
isFormSaving: false,
|
||||
notices,
|
||||
customFields,
|
||||
};
|
||||
|
@@ -8,7 +8,6 @@ export default (state, action) => {
|
||||
});
|
||||
return {
|
||||
...state,
|
||||
isFormSaving: false,
|
||||
isCustomFieldSaving: false,
|
||||
notices,
|
||||
};
|
||||
|
@@ -2,7 +2,6 @@ export default (state) => {
|
||||
const notices = state.notices.filter((notice) => notice.id !== 'custom-field');
|
||||
return {
|
||||
...state,
|
||||
isFormSaving: true,
|
||||
isCustomFieldSaving: true,
|
||||
notices,
|
||||
};
|
||||
|
Reference in New Issue
Block a user