inertia
Types
pub type NextHandle =
fn(request.Request(wisp.Connection)) -> response.Response(
wisp.Body,
)
Values
pub fn add_context(name: String, value: String) -> Nil
Adds an entry to the Inertia context
pub fn add_defer(
self: props.PageObject,
name: String,
value: fn() -> Result(json.Json, Nil),
group: option.Option(String),
) -> props.PageObject
Adds a deferred property. Usually, a deferred property is a time-consuming function that will take time
to generate its outcome. The property value is a function that returns Result(json.Json, Nil)
pub fn add_error(
self: props.PageObject,
name: String,
value: json.Json,
) -> props.PageObject
Adds an error property. The value must be a json.Json value
pub fn add_flash(
req: request.Request(wisp.Connection),
name: String,
value: String,
) -> request.Request(wisp.Connection)
Adds a flash message on the request. The flash message value IS NOT persisted between requests.
pub fn add_flashes(
req: request.Request(wisp.Connection),
messages: List(flash.FlashProp),
) -> request.Request(wisp.Connection)
Adds multiple flash messages on the request. The flash message value IS NOT persisted between requests.
pub fn add_merge(
self: props.PageObject,
name: String,
value: fn() -> json.Json,
) -> props.PageObject
Adds a Merge property
pub fn add_once(
self: props.PageObject,
name: String,
value: fn() -> json.Json,
) -> props.PageObject
Adds an once property. The property value must be a function that returns a json.Json value.
pub fn add_prop(
self: props.PageObject,
name: String,
value: json.Json,
) -> props.PageObject
Adds a basic property to be injected on the client. The value must be a json.Json value
pub fn from_context(name: String) -> String
Gets an entry from the inertia context, if it not exists returns an empty String
pub fn handle_request(
req: request.Request(wisp.Connection),
next: fn(request.Request(wisp.Connection)) -> response.Response(
wisp.Body,
),
) -> response.Response(wisp.Body)
Handle request middleware that manages all Inertia requests
pub fn new_page_object(
req: request.Request(wisp.Connection),
component: String,
) -> props.PageObject
Creates a page object that will manage all properties for the current page component.
pub fn redirect(
req: request.Request(wisp.Connection),
path: String,
) -> response.Response(wisp.Body)
Creates a reponse with status code 303 for Post, Patch, Put or Delete request, otherwise the status code is 302
#Example
inertia.redirect(req, "/")
pub fn render(
page_object: props.PageObject,
req: request.Request(wisp.Connection),
) -> response.Response(wisp.Body)
Renders a Inertia component based on the PageObject.
#Example:
inertia.new_page_object(req, "index)
|> inertia.render(req)
pub fn root_view(state: String) -> String
Creates the root view based on index.html file when the request is a full page load. If the index.html file is not found, it will render a default error message
pub fn shared_add(name: String, value: String) -> Nil
Adds a shared value to the Inertia context
pub fn shared_get(name: String) -> String
Gets a shared value from the Inertia context