feat: Cleans up routes.
This commit is contained in:
@@ -2,6 +2,7 @@ import Elementary
|
||||
import ElementaryHTMX
|
||||
import SharedModels
|
||||
|
||||
// TODO: Lazy Load branches when view appears.
|
||||
struct VendorDetail: HTML {
|
||||
|
||||
let vendor: Vendor
|
||||
@@ -15,7 +16,7 @@ struct VendorDetail: HTML {
|
||||
} closeButton: {
|
||||
Button.close(id: "float")
|
||||
.attributes(
|
||||
.hx.get(route: .vendor(.shared(.index(withBranches: true)))),
|
||||
.hx.get(route: .vendor(.index)),
|
||||
.hx.pushURL(true),
|
||||
.hx.target(.body),
|
||||
.hx.swap(.outerHTML)
|
||||
@@ -25,6 +26,7 @@ struct VendorDetail: HTML {
|
||||
|
||||
// TODO: What route for here??
|
||||
var branchForm: some HTML {
|
||||
// TODO: Add hidden input field with vendor id.
|
||||
form(
|
||||
.id("branch-form"),
|
||||
.hx.post("/vendors/\(vendor.id)/branches"),
|
||||
@@ -34,7 +36,8 @@ struct VendorDetail: HTML {
|
||||
) {
|
||||
input(
|
||||
.type(.text), .class("col-9"), .name("name"), .placeholder("Add branch..."), .required,
|
||||
.hx.post(route: .vendorBranch(.index(for: vendor.id))),
|
||||
// FIX: route
|
||||
// .hx.post(route: .vendorBranch(.index(for: vendor.id))),
|
||||
.hx.trigger(.event(.keyup).changed().delay("800ms")),
|
||||
.hx.target("#branches"),
|
||||
.hx.swap(.beforeEnd) // ,
|
||||
|
||||
Reference in New Issue
Block a user