Ticket #48981: util.js.patch
File util.js.patch, 1.2 KB (added by , 4 years ago) |
---|
-
src/js/_enqueues/wp/util.js
105 105 // Use with PHP's wp_send_json_success() and wp_send_json_error() 106 106 deferred.jqXHR = $.ajax( options ).done( function( response ) { 107 107 // Treat a response of 1 as successful for backward compatibility with existing handlers. 108 if ( response === '1' || response === 1 ) 109 response = { success: true }; 108 if ( response === '1' || response === 1 ) { 109 response = {success: true}; 110 } 110 111 111 if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) 112 deferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [response.data] ); 113 else 114 deferred.rejectWith( this, [response] ); 112 if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) { 113 deferred[response.success ? 'resolveWith' : 'rejectWith'](this, [response.data]); 114 } else { 115 deferred.rejectWith(this, [response]); 116 } 115 117 }).fail( function() { 116 118 deferred.rejectWith( this, arguments ); 117 119 });