feat: Cleans up routes.

This commit is contained in:
2025-01-19 13:33:01 -05:00
parent 1c8748211c
commit b23dc6bf07
32 changed files with 958 additions and 1786 deletions

View File

@@ -1,5 +1,6 @@
import Elementary
import ElementaryHTMX
import SharedModels
// Form used to login or create a new user.
struct UserForm: HTML, Sendable {
@@ -28,6 +29,9 @@ struct UserForm: HTML, Sendable {
value: "if(event.detail.successful) this.reset(); toggleContent('float');"
)
) {
if case let .login(next) = context, let next {
input(.type(.hidden), .name("next"), .value(next))
}
div(.class("row")) {
input(.type(.text), .id("username"), .name("username"), .placeholder("Username"), .autofocus, .required)
}
@@ -104,12 +108,13 @@ struct UserForm: HTML, Sendable {
switch self {
case .create:
return "/users"
case let .login(next: next):
let path = "/login"
if let next {
return "\(path)?next=\(next)"
}
return path
case .login:
return "/login"
// let path = "/login"
// if let next {
// return "\(path)?next=\(next)"
// }
// return path
}
}
}