Axios + NUXT ..How to update browser url with ‘slug’ data from API and Update my Base Url in axios in my page for get new data to show

So the Nuxt routing is very smart at reading your folder structure. When you want to make routes you have to follow the folder structure mentioned here. You are looking for dynamic routing. So you don’t know the route but you know it should be a name, UUID for example.

For making dynamic routes you will have in your pages/ folder a folder called person/ and in this folder, you will make a file called _id.vue. What this means is: if you set a dynamic id after person, it will call this file.

Within this file, you can then pull all the data you need in the mounted method. you can access the route and it’s params, will contain id. Via that, you can access your store if you have, or make the Axios request with the specific id needed to load the correct data.

I found this tutorial on Youtube.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top