Merge "Replace cpPosTime cookie/parameter with cpPosIndex"
[lhc/web/wiklou.git] / resources / src / mediawiki / api.js
index b4639ab..2fcb4be 100644 (file)
                 * @method
                 */
                abort: function () {
-                       $.each( this.requests, function ( index, request ) {
+                       this.requests.forEach( function ( request ) {
                                if ( request ) {
                                        request.abort();
                                }
                                        } else {
                                                parameters[ key ] = '\x1f' + parameters[ key ].join( '\x1f' );
                                        }
-                               }
-                               // Boolean values are only false when not given at all
-                               if ( parameters[ key ] === false || parameters[ key ] === undefined ) {
+                               } else if ( parameters[ key ] === false || parameters[ key ] === undefined ) {
+                                       // Boolean values are only false when not given at all
                                        delete parameters[ key ];
                                }
                        }
                                        return abortedPromise;
                                }
 
-                               return ( abortable = api.post( params, ajaxOptions ) ).then(
-                                       // If no error, return to caller as-is
-                                       null,
+                               return ( abortable = api.post( params, ajaxOptions ) ).catch(
                                        // Error handler
                                        function ( code ) {
                                                if ( code === 'badtoken' ) {