From 65588f4b98501baec6556e471a2939440ddcf462 Mon Sep 17 00:00:00 2001 From: Fabian Date: Sun, 22 Sep 2019 13:14:27 +0200 Subject: [PATCH] Change types of getForm --- src/web/helper/form.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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")({