I'm trying to run a foreach loop and add values to an array, but it's not working properly. The values in the first foreach get added properly, but none of the values in the second foreach loop get added.
My code is:
categories.forEach(async function (cat) {
te.push({ params: { slug: [cat.cat_slug] } })
var articles = await db.query(escape`
SELECT *
FROM articles
WHERE category = ${cat.id}
`)
articles.forEach(function (art) {
te.push({ params: { slug: [cat.cat_slug, art.slug] } })
})
})
Any ideas?