Fix types
This commit is contained in:
parent
838d11e253
commit
020927ae6c
|
@ -240,8 +240,15 @@ export async function fetchAppPackage(
|
||||||
|
|
||||||
async function performAppCreate(ctx: UserCtx<CreateAppRequest, App>) {
|
async function performAppCreate(ctx: UserCtx<CreateAppRequest, App>) {
|
||||||
const apps = (await dbCore.getAllApps({ dev: true })) as App[]
|
const apps = (await dbCore.getAllApps({ dev: true })) as App[]
|
||||||
const { name, url, encryptionPassword, useTemplate, templateKey } =
|
const { body } = ctx.request
|
||||||
ctx.request.body
|
const { name, url, encryptionPassword, templateKey } = body
|
||||||
|
|
||||||
|
let useTemplate
|
||||||
|
if (typeof body.useTemplate === "string") {
|
||||||
|
useTemplate = body.useTemplate === "true"
|
||||||
|
} else if (typeof body.useTemplate === "boolean") {
|
||||||
|
useTemplate = body.useTemplate
|
||||||
|
}
|
||||||
|
|
||||||
checkAppName(ctx, apps, name)
|
checkAppName(ctx, apps, name)
|
||||||
const appUrl = sdk.applications.getAppUrl({ name, url })
|
const appUrl = sdk.applications.getAppUrl({ name, url })
|
||||||
|
@ -256,9 +263,9 @@ async function performAppCreate(ctx: UserCtx<CreateAppRequest, App>) {
|
||||||
...(ctx.request.files.fileToImport as any),
|
...(ctx.request.files.fileToImport as any),
|
||||||
password: encryptionPassword,
|
password: encryptionPassword,
|
||||||
}
|
}
|
||||||
} else if (typeof ctx.request.body.file?.path === "string") {
|
} else if (typeof body.file?.path === "string") {
|
||||||
instanceConfig.file = {
|
instanceConfig.file = {
|
||||||
path: ctx.request.body.file?.path,
|
path: body.file?.path,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type { Layout, App, Screen } from "../../documents"
|
||||||
export interface CreateAppRequest {
|
export interface CreateAppRequest {
|
||||||
name: string
|
name: string
|
||||||
url?: string
|
url?: string
|
||||||
useTemplate?: boolean
|
useTemplate?: string
|
||||||
templateName?: string
|
templateName?: string
|
||||||
templateKey?: string
|
templateKey?: string
|
||||||
fileToImport?: string
|
fileToImport?: string
|
||||||
|
|
Loading…
Reference in New Issue