Fix types

This commit is contained in:
Adria Navarro 2024-10-22 13:19:04 +02:00
parent 838d11e253
commit 020927ae6c
2 changed files with 12 additions and 5 deletions

View File

@ -240,8 +240,15 @@ export async function fetchAppPackage(
async function performAppCreate(ctx: UserCtx<CreateAppRequest, App>) {
const apps = (await dbCore.getAllApps({ dev: true })) as App[]
const { name, url, encryptionPassword, useTemplate, templateKey } =
ctx.request.body
const { body } = ctx.request
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)
const appUrl = sdk.applications.getAppUrl({ name, url })
@ -256,9 +263,9 @@ async function performAppCreate(ctx: UserCtx<CreateAppRequest, App>) {
...(ctx.request.files.fileToImport as any),
password: encryptionPassword,
}
} else if (typeof ctx.request.body.file?.path === "string") {
} else if (typeof body.file?.path === "string") {
instanceConfig.file = {
path: ctx.request.body.file?.path,
path: body.file?.path,
}
}

View File

@ -4,7 +4,7 @@ import type { Layout, App, Screen } from "../../documents"
export interface CreateAppRequest {
name: string
url?: string
useTemplate?: boolean
useTemplate?: string
templateName?: string
templateKey?: string
fileToImport?: string