vuejs-wordpress-theme-starter icon indicating copy to clipboard operation
vuejs-wordpress-theme-starter copied to clipboard

State error and can't connect to api

Open moreplease opened this issue 5 years ago • 10 comments

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?

moreplease avatar Feb 18 '20 15:02 moreplease

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?

EvanAgee avatar Feb 18 '20 15:02 EvanAgee

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.

moreplease avatar Feb 18 '20 15:02 moreplease

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

Yourgene avatar Feb 18 '20 20:02 Yourgene

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.

moreplease avatar Feb 19 '20 09:02 moreplease

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.

Yourgene avatar Feb 19 '20 09:02 Yourgene

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

moreplease avatar Feb 19 '20 09:02 moreplease

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

Yourgene avatar Feb 19 '20 09:02 Yourgene

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 avatar Feb 19 '20 10:02 moreplease

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.

moreplease avatar Feb 19 '20 19:02 moreplease

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

gradedcatfood avatar Mar 03 '20 03:03 gradedcatfood