Display loading animation when listing newsletter templates

This commit is contained in:
Tautvidas Sipavičius
2016-02-10 19:15:42 +02:00
parent eb27de36f4
commit 9223fbf478

View File

@ -24,11 +24,14 @@ define(
template.body = JSON.stringify(template.body);
}
MailPoet.Modal.loading(true);
MailPoet.Ajax.post({
endpoint: 'newsletterTemplates',
action: 'save',
data: template
}).done(function(response) {
MailPoet.Modal.loading(false);
if(response.result === true) {
this.props.onImport(template);
} else {
@ -92,10 +95,13 @@ define(
getTemplates: function() {
this.setState({ loading: true });
MailPoet.Modal.loading(true);
MailPoet.Ajax.post({
endpoint: 'newsletterTemplates',
action: 'getAll',
}).done(function(response) {
MailPoet.Modal.loading(false);
if(this.isMounted()) {
if(response.length === 0) {