EvanAgee / vuejs-wordpress-theme-starter

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

State error and can't connect to api #105

Open moreplease opened 4 years ago

moreplease commented 4 years ago

Hi, I'm getting these errors in the console: https://gyazo.com/3e7eda072da541876134983fc825d00a. I'm using mampps and website displays on this link: http://localhost:8888/vuejs/.

I've just cloned your project and used npm install and then npm run watch without any errors.

Any ideas of what can be wrong with it?

EvanAgee commented 4 years ago

Hello @moreplease thanks for reaching out. I wanted to clarify are you getting this error with the most recent version of the project or an older version? Can you show me a screenshot or paste the code of the Vuex module that's causing the error so I can suggest a fix?

moreplease commented 4 years ago

I have the newest files from your github. Just installed it around 20 minutes ago and haven't made any changes. However I'm getting these errors: https://gyazo.com/3e7eda072da541876134983fc825d00a.

I've saved permalinks however looks like it can't connect to WP API.

Yourgene commented 4 years ago

Hi, your error is related to https://github.com/EvanAgee/vuejs-wordpress-theme-starter/issues/52

moreplease commented 4 years ago

Thanks! I've added vuejs/ on the path like this: https://gyazo.com/03c947f99941bc1d003000dc6545644f and also in settings and don't have any errors in the console. However I don't see any content that is written in Home.vue.

Yourgene commented 4 years ago

Hi,

I had same errors as you yesterday during my initialization. I assume you are working on a local server, so your url looks like that in the browser : http://localhost:80/vuejs/

First, you should add a "/" before all your "vuejs" in the router.

Second, go to settings.js and change your API_BASE_PATH to API_BASE_PATH: "http://localhost:80/vuejs/wp-json/wp/v2/"

That's what I did to make it work.

moreplease commented 4 years ago

Almost done. However still see some errors in the console: https://gyazo.com/d74d18c49a651b65741b21e6e53edd7e.

Here is settings.js file: https://gyazo.com/3eb29a76c43ec5044def2c280879c5bb Here is index.js: https://gyazo.com/035582e7dee7fd3b114b65b151769c68

Yourgene commented 4 years ago

You didnt change your API BASE PATH, as explained in my previous comment

moreplease commented 4 years ago

Hmm, now I see recent posts, but when I click on it, it doesn't display anything and link looks like: http://localhost:8888/vuejs/:8888/vuejs/2020/02/18/hello-world/.

API_BASE_PATH: "http://localhost:8888/vuejs/wp-json/wp/v2/"

moreplease commented 4 years ago

Isn't there an error? I needed to add [0] to pageContent, because it didn't work.

https://gyazo.com/36b5b116bc7bd8f2aa7b8b2b18fb65dc

Does it work for you without [0]? For me pageContent.titlle is undefined.

michaelmillis commented 4 years ago

Isn't there an error? I needed to add [0] to pageContent, because it didn't work.

https://gyazo.com/36b5b116bc7bd8f2aa7b8b2b18fb65dc

Does it work for you without [0]? For me pageContent.titlle is undefined.

I believe this has been resolved as of 106