Changeset 39682 for branches/4.7
- Timestamp:
- 01/05/2017 03:05:57 AM (8 years ago)
- Location:
- branches/4.7
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.7
-
branches/4.7/src/wp-includes/js/wp-api.js
r39604 r39682 322 322 getModel = new wp.api.models[ modelName ]( attributes ); 323 323 324 // If we didn’t have an embedded getModel, fetch the getModel data.325 324 if ( ! getModel.get( embedCheckField ) ) { 326 getModel.fetch( { success: function( getModel ) { 327 deferred.resolve( getModel ); 328 } } ); 325 getModel.fetch( { 326 success: function( getModel ) { 327 deferred.resolve( getModel ); 328 }, 329 error: function( getModel, response ) { 330 deferred.reject( response ); 331 } 332 } ); 329 333 } else { 334 // Resolve with the embedded model. 330 335 deferred.resolve( getModel ); 331 336 } … … 393 398 // If we didn’t have embedded getObjects, fetch the getObjects data. 394 399 if ( _.isUndefined( getObjects.models[0] ) ) { 395 getObjects.fetch( { success: function( getObjects ) { 396 397 // Add a helper 'parent_post' attribute onto the model. 398 setHelperParentPost( getObjects, postId ); 399 deferred.resolve( getObjects ); 400 } } ); 400 getObjects.fetch( { 401 success: function( getObjects ) { 402 403 // Add a helper 'parent_post' attribute onto the model. 404 setHelperParentPost( getObjects, postId ); 405 deferred.resolve( getObjects ); 406 }, 407 error: function( getModel, response ) { 408 deferred.reject( response ); 409 } 410 } ); 401 411 } else { 402 412
Note: See TracChangeset
for help on using the changeset viewer.