EvanAgee / vuejs-wordpress-theme-starter

A WordPress theme with the guts ripped out and replaced with Vue.
https://vuewp.com/
1.6k stars 281 forks source link

404 on the api #20

Closed nhekkens closed 6 years ago

nhekkens commented 6 years ago

Hey,

So ive just downloaded the latest WP (4.9.5) and installed your theme, ran NPM install and npm run production.

Theme is working however i get 404 on all the api requests to wp-json/wp/v2/

I then changed it to ?rest_route=/wp/v2/ in app.js ( If i put that into the browser it returns JSON )

Unfortunately im still getting the same issue.

Am i missing something or is this due to a later version of WP?

Thanks

raisiqueira commented 6 years ago

Did you change the permanent url?

EvanAgee commented 6 years ago

Hey guys, no I'm not aware of anything that would have changed to cause this issue. You need to ensure that the REST API isn't disabled for your WP instance and then once you find the correct path for it (which shouldn't have changed) you can update that settings object to reflect the correct path. Is anyone aware of any changes to the core API that would be causing this?

nhekkens commented 6 years ago

I've googled around a bit and i believe its something to do with my MAMP Setup. However still dont have a solution :(

@EvanAgee where do i make sure i havent disabled it?

nhekkens commented 6 years ago

/?rest_route=/ Shows me

"/wp/v2": { "namespace": "wp/v2", "methods": [ "GET" ], "endpoints": [ { "methods": [ "GET" ], "args": { "namespace": { "required": false, "default": "wp/v2" }, "context": { "required": false, "default": "view" } } } ], "_links": { "self": "http://lewis.local/wp-json/wp/v2" } },

Going to "self": "http://lewis.local/wp-json/wp/v2" gives me The requested URL /wp-json/wp/v2 was not found on this server.

Cant think of any other reason this is happening apart from my Apache setup?

nhekkens commented 6 years ago

Sorry guys just realised i didn't have AllowOverride All in my v-host, which meant that my htaccess file wasn't being read resulting in the 404. Thats now working.

Im no longer getting 404 console logs for the api requests. BUT im still getting console.log errors. ( I haven't changed any code )

vendor.js:54123 [Vue warn]: Error in render function: "TypeError: Cannot read property 'rendered' of undefined"

found in

---> at src/components/widgets/Pages.vue

at src/components/Home.vue at src/App.vue Any ideas?
nhekkens commented 6 years ago

Fixed the issue.

bbuilds commented 5 years ago

Hi @nhekkens do you mind sharing how you fixed your issue? I'm running into the same. Kinda new to this. My local setup, using VVV, only shows the posts if I use the URL ?rest_route=/wp/v2/ int he browser instead of wp-json/wp/v2/

I also get the same error "rendered undefined" and would love to know how you fixed it.

thanks!

bbuilds commented 5 years ago

nvm, i fixed the issue by updating permalinks!