feat: Cleans up routes.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user