Change types of getForm
This commit is contained in:
parent
3546202907
commit
65588f4b98
@ -1,5 +1,5 @@
|
|||||||
import { Middleware } from "koa";
|
|
||||||
import getTemplate from "./hb";
|
import getTemplate from "./hb";
|
||||||
|
import { Context } from "vm";
|
||||||
|
|
||||||
interface IFormConfigField {
|
interface IFormConfigField {
|
||||||
type: "text" | "number" | "boolean" | "textarea";
|
type: "text" | "number" | "boolean" | "textarea";
|
||||||
@ -9,7 +9,7 @@ interface IFormConfigField {
|
|||||||
|
|
||||||
type IFormConfig = { [name: string]: 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] }))
|
let fields = Object.keys(fieldConfig).map(name => ({ name, ...fieldConfig[name] }))
|
||||||
|
|
||||||
return ctx => ctx.body = getTemplate("forms")({
|
return ctx => ctx.body = getTemplate("forms")({
|
||||||
|
Reference in New Issue
Block a user