diff --git a/src/web/helper/form.ts b/src/web/helper/form.ts index 8ab502f..d126153 100644 --- a/src/web/helper/form.ts +++ b/src/web/helper/form.ts @@ -1,5 +1,5 @@ -import { Middleware } from "koa"; import getTemplate from "./hb"; +import { Context } from "vm"; interface IFormConfigField { type: "text" | "number" | "boolean" | "textarea"; @@ -9,7 +9,7 @@ interface IFormConfigField { type IFormConfig = { [name: string]: IFormConfigField } -export default function getForm(url: string, title: string, fieldConfig: IFormConfig): Middleware { +export default function getForm(url: string, title: string, fieldConfig: IFormConfig): (ctx: Context) => void { let fields = Object.keys(fieldConfig).map(name => ({ name, ...fieldConfig[name] })) return ctx => ctx.body = getTemplate("forms")({