feat: Working on fixing todos.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user