You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
728 B
30 lines
728 B
import Elementary |
|
import ElementaryHTMX |
|
import ElementaryHTMXSSE |
|
import ElementaryHTMXWS |
|
import Fluent |
|
import Vapor |
|
import VaporElementary |
|
|
|
struct TestController: RouteCollection { |
|
|
|
func boot(routes: RoutesBuilder) throws { |
|
routes.group("test") { test in |
|
test.get("toast", use: toast) |
|
} |
|
} |
|
|
|
@Sendable |
|
func toast(req: Request) async throws -> HTMLResponse { |
|
|
|
let state = try getState(request: req) |
|
state.toast = ToastState(message: "Wow!", |
|
title: "This is my title", |
|
level: ToastState.Level.success) |
|
|
|
throw Abort(.badRequest, headers: ["HX-Trigger": "toast"]) |
|
|
|
// return HTMLResponse { } |
|
} |
|
|
|
}
|
|
|