bshiluk / vue-wordpress

Use Vue.js and the WP REST API to build WordPress themes as SPAs with dynamic routing, HMR for development, SEO enabled, and SSR capable. Demo:
http://vue-wordpress-demo.bshiluk.com
491 stars 112 forks source link

Doesn't work if slug contains HTML entities #4

Closed shubhra14 closed 5 years ago

shubhra14 commented 5 years ago

Hi again, Another small issue. It fails to fetch the data if the slug contains html entities /wp-json/wp/v2/pages/?slug=this-is-a-%E0%A5%90-page. Happens with posts as well as pages.

bshiluk commented 5 years ago

Are you sure that's the slug WP is generating?

I'll look into it later.

shubhra14 commented 5 years ago

Yes, its coming from WP. I can access the post if I visit the api link directly, however, the "post" is undefined in the vue development tab wp-json vue-tab network-tab

shubhra14 commented 5 years ago

Sorry to bother you with this, did you find the time to look at this issue?

I would love wider knowledge on why it could be happening and I can try and troubleshoot it. Thank you!

bshiluk commented 5 years ago

Ya sorry, have been busy the past week. Will look into it either tonight or tomorrow and apply a fix.

If it's something that'll take longer to fix, I'll provide some direction, so you can implement those changes.

Apologize for the delayed response.

shubhra14 commented 5 years ago

It is perfectly fine. I appreciate you helping me out.

bshiluk commented 5 years ago

Fixed in latest update.

The singleBySlug getter was comparing an encoded slug to a decoded slug, resulting in a 404. Just used decodeURI() to ensure consistency.

Should for sure work for you, but let me know.

shubhra14 commented 5 years ago

It works. Thank you!

I have learned so much digging into this. I am not a developer, however, its amazing how easy it is to build on top of this bundle once you learn the basics. Appreciate you sharing it with us.

Looking forward to more features ;)