feat: adds next route to login.

This commit is contained in:
2026-01-04 09:30:14 -05:00
parent a61c772f7b
commit f159c3ab75
11 changed files with 2326 additions and 56 deletions

View File

@@ -5,9 +5,11 @@ import Styleguide
struct LoginForm: HTML, Sendable {
let style: Style
let next: String?
init(style: Style = .login) {
init(style: Style = .login, next: String? = nil) {
self.style = style
self.next = next
}
var body: some HTML {
@@ -18,6 +20,11 @@ struct LoginForm: HTML, Sendable {
form(
.method(.post)
) {
if let next {
input(.class("hidden"), .name("next"), .value(next))
}
fieldset(.class("fieldset bg-base-200 border-base-300 rounded-box w-xl border p-4")) {
legend(.class("fieldset-legend")) { style.title }
@@ -81,7 +88,7 @@ struct LoginForm: HTML, Sendable {
button(.class("btn btn-secondary mt-4")) { style.title }
a(
.class("btn btn-link mt-4"),
.href(route: style == .signup ? .login(.index) : .signup(.index))
.href(route: style == .signup ? .login(.index(next: next)) : .signup(.index))
) {
style == .login ? "Sign Up" : "Login"
}