config in context

This commit is contained in:
Martin McKeaveney 2020-04-06 09:09:48 +01:00
parent ec3f754a41
commit 81d878bf4e
4 changed files with 6 additions and 5 deletions

View File

@ -23,7 +23,7 @@ router.get("/_builder/api/:appname/appPackage", async ctx => {
router router
.post("/_builder/api/:appname/backend", async ctx => { .post("/_builder/api/:appname/backend", async ctx => {
await saveBackend( await saveBackend(
config, ctx.config,
ctx.params.appname, ctx.params.appname,
ctx.request.body.appDefinition, ctx.request.body.appDefinition,
ctx.request.body.accessLevels ctx.request.body.accessLevels

View File

@ -22,6 +22,7 @@ module.exports = (config, app) => {
.use(async (ctx, next) => { .use(async (ctx, next) => {
ctx.sessionId = ctx.session._sessCtx.externalKey ctx.sessionId = ctx.session._sessCtx.externalKey
ctx.session.accessed = true ctx.session.accessed = true
ctx.config = config
const pathParts = ctx.path.split("/") const pathParts = ctx.path.split("/")

View File

@ -11,7 +11,7 @@ const router = Router();
router.get("/_builder/api/:appname/components", async ctx => { router.get("/_builder/api/:appname/components", async ctx => {
try { try {
ctx.body = getComponentDefinitions( ctx.body = getComponentDefinitions(
config, ctx.config,
ctx.params.appname, ctx.params.appname,
ctx.query.lib ctx.query.lib
) )
@ -27,7 +27,7 @@ router.get("/_builder/api/:appname/components", async ctx => {
router.get("/_builder/api/:appname/componentlibrary", async ctx => { router.get("/_builder/api/:appname/componentlibrary", async ctx => {
const info = await componentLibraryInfo( const info = await componentLibraryInfo(
config, ctx.config,
ctx.params.appname, ctx.params.appname,
ctx.query.lib ? decodeURI(ctx.query.lib) : "" ctx.query.lib ? decodeURI(ctx.query.lib) : ""
) )
@ -37,7 +37,7 @@ router.get("/_builder/api/:appname/componentlibrary", async ctx => {
router.get("/_builder/:appname/componentlibrary", async ctx => { router.get("/_builder/:appname/componentlibrary", async ctx => {
const info = await componentLibraryInfo( const info = await componentLibraryInfo(
config, ctx.config,
ctx.params.appname, ctx.params.appname,
ctx.query.lib ctx.query.lib
) )

View File

@ -59,7 +59,7 @@ router
router.post("/_builder/api/:appname/pages/:pageName", async ctx => { router.post("/_builder/api/:appname/pages/:pageName", async ctx => {
await buildPage( await buildPage(
config, ctx.config,
ctx.params.appname, ctx.params.appname,
ctx.params.pageName, ctx.params.pageName,
ctx.request.body ctx.request.body