front / gutenberg-js

JavaScript only version of the WordPress Gutenberg editor (DEPRECATED)
GNU General Public License v2.0
390 stars 42 forks source link

Connecting to Wordpress issues #17

Open botoxparty opened 5 years ago

botoxparty commented 5 years ago

Hey,

Really love that this is a project. Been playing around with it and i've been able to get it to connect successfuly and using authentication to WP API.

However some actions aren't working. e.g. I can't seem to add any categories/tags, publish content, or do anything with media.

Some of the requests coming from gutenberg look like this categories?per_page=-1&orderby=name&order=asc&_fields=id%2Cname%2Cparent

if i run this request in postman it fails because of the per_page=-1 . When i use gutenberg from within wordpress and i monitor the requests I see the same one being done with per_page=100 .

Also it says that you need permission to upload media. I'm definitely an admin and logged in.

Any ideas?

Best, Adam

botoxparty commented 5 years ago

Confirming that its the per_page=-1, if I modify the URL using an interceptor to be per_page=100 then i can receive categories and tags.

Not sure where -1 gets generated from. Guess i've got some exploring to do.

botoxparty commented 5 years ago

Okay so i can see that it was changed in Gutenberg to ask for -1, not sure why my Wordpress API doesnt support -1 i'm on the latest.

https://github.com/WordPress/gutenberg/pull/11654/files

Regarding the media uploads. Gutenberg calls to /wp/v2/media OPTIONS, it does so twice in my setup, one it returns GET as a method, the second time it returns GET and POST.

Not sure what to do for solutions.

botoxparty commented 5 years ago

So i can force it to accept media uploads by calling data.dispatch("core").receiveUploadPermissions(true); manually. However the payload when it tries to send the file to /wp/v2/media is empty