Reorganized new API + added legacy API support + new API

- Updated Settings Router to new standards
- Updated settings.html to reflect API change with better error handling
- Updated Settings API unit tests
This commit is contained in:
Jonathan Labreuille
2016-08-01 16:57:53 +02:00
parent 354d249e1d
commit 9410d4f10a
26 changed files with 216 additions and 93 deletions

View File

@ -8,9 +8,7 @@ define('ajax', ['mailpoet', 'jquery', 'underscore'], function(MailPoet, jQuery,
endpoint: null,
action: null,
token: null,
data: {},
onSuccess: function(data, textStatus, xhr) {},
onError: function(xhr, textStatus, errorThrown) {}
data: {}
},
get: function(options) {
return this.request('get', options);
@ -72,9 +70,7 @@ define('ajax', ['mailpoet', 'jquery', 'underscore'], function(MailPoet, jQuery,
url: this.options.url,
type : 'post',
data: params,
dataType: 'json',
success : this.options.onSuccess,
error : this.options.onError
dataType: 'json'
});
}