From aab4f60d76649d366e99413d2110fb0d477b45ee Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 6 Nov 2020 13:40:00 +0000 Subject: [PATCH] small tidy ups --- packages/builder/src/pages/index.svelte | 2 +- packages/server/src/api/controllers/application.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/pages/index.svelte b/packages/builder/src/pages/index.svelte index 5462494397..fcf0f5af52 100644 --- a/packages/builder/src/pages/index.svelte +++ b/packages/builder/src/pages/index.svelte @@ -62,7 +62,7 @@ - + diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js index 3894ed85a0..8b931d14c8 100644 --- a/packages/server/src/api/controllers/application.js +++ b/packages/server/src/api/controllers/application.js @@ -76,10 +76,8 @@ exports.fetchAppPackage = async function(ctx) { ) pages = pages.rows.map(row => row.doc) - const mainPage = pages.filter(page => page.name === PageTypes.MAIN)[0] - const unauthPage = pages.filter( - page => page.name === PageTypes.UNAUTHENTICATED - )[0] + const mainPage = pages.find(page => page.name === PageTypes.MAIN) + const unauthPage = pages.find(page => page.name === PageTypes.UNAUTHENTICATED) ctx.body = { application, pages: { @@ -139,7 +137,6 @@ exports.delete = async function(ctx) { const result = await db.destroy() // remove top level directory - // TODO: look into why this isn't a callback await fs.rmdir(join(budibaseAppsDir(), ctx.params.appId), { recursive: true, }) @@ -160,14 +157,16 @@ const createEmptyAppPackage = async (ctx, app) => { } fs.mkdirpSync(newAppFolder) + const mainPage = cloneDeep(MAIN) mainPage._id = generatePageID() mainPage.title = app.name + const unauthPage = cloneDeep(UNAUTHENTICATED) unauthPage._id = generatePageID() - // TODO: fix - handlebars etc unauthPage.title = app.name unauthPage.props._children[0].title = `Log in to ${app.name}` + const homeScreen = cloneDeep(HOME_SCREEN) homeScreen._id = generateScreenID(mainPage._id) await db.bulkDocs([mainPage, unauthPage, homeScreen])