Started the insert page but need to take a break to do the final part.

main
Zed A. Shaw 2 days ago
parent ea3b59129f
commit b0ba0c7e16
  1. 15
      admin/handlers.go
  2. 2
      common/web.go

@ -71,7 +71,15 @@ func PostApiUpdate(c *fiber.Ctx) error {
return c.RedirectBack("/admin/table/", 303)
}
func PutApiInsert(c *fiber.Ctx) error {
func GetPageInsert(c *fiber.Ctx) error {
table := c.Params("table")
// NOTE: need to get a blank json for the table schema and use that to populate the template OR have a simple get that does it. Probably the former.
return c.Render("admin/table/new", fiber.Map{ "Table": table })
}
func PostApiInsert(c *fiber.Ctx) error {
return c.JSON(fiber.Map{})
}
@ -93,10 +101,13 @@ func Setup(app *fiber.App) {
app.Get("/api/admin/table/:table/", GetApiSelectAll)
app.Get("/admin/table/:table/", GetPageSelectAll)
app.Get("/admin/new/table/:table/", GetPageInsert)
app.Post("/api/admin/new/table/:table/", PostApiInsert)
app.Get("/api/admin/table/:table/:id/", GetApiSelectOne)
app.Get("/admin/table/:table/:id/", GetPageSelectOne)
app.Post("/api/admin/table/:table/:id/", PostApiUpdate)
app.Put("/api/admin/table/:table/:id/", PutApiInsert)
app.Delete("/api/admin/table/:table/:id/", DeleteApi)
}

@ -12,7 +12,7 @@ import (
func Page(path string) (func(c *fiber.Ctx) error) {
return func (c *fiber.Ctx) error {
return c.Render("stream", fiber.Map{})
return c.Render(path, fiber.Map{})
}
}

Loading…
Cancel
Save