From c0d54aa8ce725ad8ade37c1e33402bcbb5a32cf6 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Mon, 21 Sep 2020 18:02:48 -0500 Subject: [PATCH] Add /kind/ to generated routes --- nuxt.config.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/nuxt.config.js b/nuxt.config.js index 7b78b06..b699538 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -16,7 +16,7 @@ const storeAppList = async function (builder) { // console.log('builder.nuxt.options', builder.nuxt.options) await fs.writeFile(appListPath, JSON.stringify(appList)) -} +} export default { @@ -43,10 +43,28 @@ export default { const appList = importedAppList.default // console.log('appList', appList) - return appList.map(app => ({ + const appRoutes = appList.map(app => ({ route: '/app/' + app.slug, - payload: appList + // payload: appList })) + + const sectionList = [] + + appList.forEach(app => { + if (sectionList.includes(app.section.slug)) return + + sectionList.push(app.section.slug) + }) + + const sectionRoutes = sectionList.map(slug => ({ + route: '/kind/' + slug, + // payload: appList + })) + + return [ + ...appRoutes, + ...sectionRoutes + ] }) } },