Right now I have this
routes () {
return axios.get(`http://example.me/articles/crypto`)
.then(res => res.data.map(article => '/crypto/' + article.slug))
}
As I see it, it just returns generated URL. But what if I want to use something like this in example
{
url: '/page/2',
changefreq: 'daily',
priority: 1,
lastmodISO: '2017-06-30T13:30:00.000Z'
}
I can define it in then
?
your
.map()
can return an object:routes () { return axios.get(`http://example.me/articles/crypto`) .then(res => res.data.map(article => ({ url: `/crypto/${article.slug}`, changefreq: 'daily', priority: 1, lastmodISO: '2017-06-30T13:30:00.000Z' }))); }