feat: Working on fixing todos.

This commit is contained in:
2025-01-24 17:07:59 -05:00
parent 978ce8c74f
commit 000f8ce16b
3 changed files with 4 additions and 21 deletions

View File

@@ -2,8 +2,6 @@ import DatabaseClientLive
import SharedModels
import Vapor
// TODO: Fix before production.
extension RoutesBuilder {
// Used to ensure views are protected, redirects users to the login page if they're

View File

@@ -20,7 +20,7 @@ struct UserForm: HTML, Sendable {
form(
.id(.user(.form)),
.class("user-form"),
.hx.post(context.targetURL),
.hx.post(route: context.targetURL),
.hx.pushURL(context.pushURL),
.hx.target(context.target),
.hx.swap(context == .create ? .afterBegin.transition(true).swap("0.5s") : .outerHTML),
@@ -101,18 +101,12 @@ struct UserForm: HTML, Sendable {
}
}
// TODO: Return a ViewRoute.
var targetURL: String {
var targetURL: ViewRoute {
switch self {
case .create:
return "/users"
return .user(.index)
case .login:
return "/login"
// let path = "/login"
// if let next {
// return "\(path)?next=\(next)"
// }
// return path
return .login(.index())
}
}
}

View File

@@ -2,15 +2,6 @@ import Elementary
import SharedModels
import URLRouting
// TODO: Remove.
struct ToggleFormButton: HTML, Sendable {
var content: some HTML<HTMLTag.a> {
a(.href("javascript:void(0)"), .on(.click, "toggleContent('form')"), .class("btn-add")) {
"+"
}
}
}
enum Button {
@Sendable