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',
|
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);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -19,7 +19,6 @@ export default (state, action) => {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
isCustomFieldSaving: false,
|
isCustomFieldSaving: false,
|
||||||
isFormSaving: false,
|
|
||||||
notices,
|
notices,
|
||||||
customFields,
|
customFields,
|
||||||
};
|
};
|
||||||
|
@@ -8,7 +8,6 @@ export default (state, action) => {
|
|||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
isFormSaving: false,
|
|
||||||
isCustomFieldSaving: false,
|
isCustomFieldSaving: false,
|
||||||
notices,
|
notices,
|
||||||
};
|
};
|
||||||
|
@@ -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,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user