Skip to content

Keep wp.apiRequest to use Promise .then( resolve, reject ) - #5450

Merged
mkaz merged 2 commits into
masterfrom
fix/ApiRequestThen
Mar 14, 2018
Merged

mkaz merged 2 commits into
masterfrom
fix/ApiRequestThen

Conversation

@mkaz

@mkaz mkaz commented Mar 6, 2018

Copy link
Copy Markdown
Member

Description

The response from wp.apiRequest should not assume it is an jQuery ajax response, but should be a Promise with the signature .then( resolve, reject ) this is consistent with the other calls of
wp.apiRequest.

How Has This Been Tested?

This change applies to UPDATE_POST so testing confirmed creating and updating posts still work.

Types of changes

Bug fix (non-breaking change which fixes an issue). Our use case has us proxying the behavior for wp.apiRequest so it does not return jQuery.ajax request but a Promise.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.

@mkaz
mkaz requested a review from youknowriad March 6, 2018 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants