-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
withAPIData does not work with custom endpoints #3209
Comments
This seems to come from the
gutenberg/editor/provider/index.js Line 118 in b538874
schema attr that looks like this for me:
This really doesn't include any /cc @aduth |
I guess that's probably the reason we need the So that might be the way to fix this for custom endpoints. |
Hmm, ideally we'd not have to initialize each namespace separately and could instead load in a single schema for all endpoints of the REST API. Might be that we drop gutenberg/lib/client-assets.php Lines 480 to 487 in 05f8169
|
Related: #3462 |
Issue Overview
withAPIData
does not work with custom endpoints.Steps to Reproduce (for bugs)
update/block-support
branch)update/use-custom-endpoint
branch).cd
into the directory and runnpm install
andnpm run build
. Upload the plugin to your site and activate it./sensei/v1/courses
, although there is a request to/wp/v2/course-category
.Chrome 61.0.3163.100 on MacOS 10.12.6 and WordPress 4.9-beta4-42028, Gutenberg 1.5.2.
Expected Behavior
I expect a request to be made to the custom endpoint and results to be returned.
Current Behavior
No API data is returned. In fact, the request is not even sent.
Possible Solution
When using a
path
set to/sensei/v1/courses
, thegetRoute
function returnsfalse
, which in turn causes theapplyMapping
function to return early.In other words, it seems like there is currently a requirement for a custom endpoint to start with
/wp/v2
.Todos
The text was updated successfully, but these errors were encountered: