mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-05-15 14:36:07 +00:00

Remove need to add all mail template params to view response data. This was originally intended functionality but the wrong value was passed to the `deliver` function, and no `data` argument was given, making it cumbersome to create new values.
18 lines
571 B
Zig
18 lines
571 B
Zig
const std = @import("std");
|
|
const jetzig = @import("jetzig");
|
|
|
|
/// This example demonstrates usage of Jetzig's background jobs.
|
|
pub fn index(request: *jetzig.Request, data: *jetzig.Data) !jetzig.View {
|
|
// Prepare a job using `src/app/jobs/example.zig`.
|
|
var job = try request.job("example");
|
|
|
|
// Add a param `foo` to the job.
|
|
try job.params.put("foo", data.string("bar"));
|
|
try job.params.put("id", data.integer(std.crypto.random.int(u32)));
|
|
|
|
// Schedule the job for background processing.
|
|
try job.schedule();
|
|
|
|
return request.render(.ok);
|
|
}
|