feat: Working on fixing todos.
This commit is contained in:
@@ -2,8 +2,6 @@ import DatabaseClientLive
|
|||||||
import SharedModels
|
import SharedModels
|
||||||
import Vapor
|
import Vapor
|
||||||
|
|
||||||
// TODO: Fix before production.
|
|
||||||
|
|
||||||
extension RoutesBuilder {
|
extension RoutesBuilder {
|
||||||
|
|
||||||
// Used to ensure views are protected, redirects users to the login page if they're
|
// Used to ensure views are protected, redirects users to the login page if they're
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ struct UserForm: HTML, Sendable {
|
|||||||
form(
|
form(
|
||||||
.id(.user(.form)),
|
.id(.user(.form)),
|
||||||
.class("user-form"),
|
.class("user-form"),
|
||||||
.hx.post(context.targetURL),
|
.hx.post(route: context.targetURL),
|
||||||
.hx.pushURL(context.pushURL),
|
.hx.pushURL(context.pushURL),
|
||||||
.hx.target(context.target),
|
.hx.target(context.target),
|
||||||
.hx.swap(context == .create ? .afterBegin.transition(true).swap("0.5s") : .outerHTML),
|
.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: ViewRoute {
|
||||||
var targetURL: String {
|
|
||||||
switch self {
|
switch self {
|
||||||
case .create:
|
case .create:
|
||||||
return "/users"
|
return .user(.index)
|
||||||
case .login:
|
case .login:
|
||||||
return "/login"
|
return .login(.index())
|
||||||
// let path = "/login"
|
|
||||||
// if let next {
|
|
||||||
// return "\(path)?next=\(next)"
|
|
||||||
// }
|
|
||||||
// return path
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,6 @@ import Elementary
|
|||||||
import SharedModels
|
import SharedModels
|
||||||
import URLRouting
|
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 {
|
enum Button {
|
||||||
|
|
||||||
@Sendable
|
@Sendable
|
||||||
|
|||||||
Reference in New Issue
Block a user