*
* @param {string} tokenType The name of the token, like options or edit.
* @param {Object} params API parameters
+ * @param {Object} [ajaxOptions]
* @return {jQuery.Promise} See #post
* @since 1.22
*/
- postWithToken: function ( tokenType, params ) {
+ postWithToken: function ( tokenType, params, ajaxOptions ) {
var api = this;
+ // Do not allow deprecated ok-callback
+ // FIXME: Remove this check when the deprecated ok-callback is removed in #post
+ if ( $.isFunction( ajaxOptions ) ) {
+ ajaxOptions = undefined;
+ }
+
return api.getToken( tokenType ).then( function ( token ) {
params.token = token;
- return api.post( params ).then(
+ return api.post( params, ajaxOptions ).then(
// If no error, return to caller as-is
null,
// Error handler
// Try again, once
return api.getToken( tokenType ).then( function ( token ) {
params.token = token;
- return api.post( params );
+ return api.post( params, ajaxOptions );
} );
}