Home

Issue: 440

Multiple dynamic

[issue link]

Hi,
Sorry it’s me again!

Considering the changes in the generate routes configuration, I’m stuck because I have more than one dynamic routes to use.

I was using this, and I don’t see how to “translate” it to the new way:

routeParams: {
	'/blog/:slug': function () {
		return axios.get('https://rest.emmanuelbeziat.com/posts')
		.then((response) => {
			return response.data.map((post) => {
				return { slug: post.slug }
			})
		})
	},
	'/portfolio/:slug': function () {
		return axios.get('https://rest.emmanuelbeziat.com/portfolio')
		.then((response) => {
			return response.data.map((portfolio) => {
				return { slug: portfolio.slug }
			})
		})
	}
}

As the docs suggest to have a return, I don’t know how to pass it multiple routes. I took a look at the docs’s source, but it seems it’s still using the previous version.

Sorry, this one is totally a lack of JS knowledge on my side…

Thanks for your help.

This question is available on Nuxt.js community (#c383)