wisp_flash
Values
pub fn get_flash(
request: request.Request(@internal Connection),
next: fn(option.Option(String), option.Option(String)) -> response.Response(
wisp.Body,
),
) -> response.Response(wisp.Body)
Get the flash message and kind. This middleware goes around your request. This gets the values from the cookies and then deletes them. The middleware callback will return the alert kind and message. After putting these values in the context, you can use them to render alerts in your view.
Example
use kind, message <- wisp_flash.get_flash(request)
let ctx = Context(..ctx, flash_kind: kind, flash_message: message)
pub fn set_flash(
response response: response.Response(wisp.Body),
request request: request.Request(@internal Connection),
kind kind: String,
message message: String,
) -> response.Response(wisp.Body)
Set a flash message in the session cookie. This will store two cookies. One for the message and one for the notification kind.
Example
wisp.redirect("/home")
|> wisp_flash.set_flash(request, "success", "Document Saved")