Liking cljdoc? Tell your friends :D

Errors, flash and shared props

Validation errors and flash

errors is always sent and defaults to {}. By default the middleware reads (:errors (:flash req)), so a failed form can redirect back with:

(assoc (resp/redirect "/users/create") :flash {:errors {:name "Required"}})

Pass :errors to wrap-inertia to read errors from somewhere else. Pass :flash (fn [req] ...) to fill the page's flash key, which the client reads as usePage().flash.

Shared props

Use the :share fn for props every page needs. Use (inertia/share req {...}) in your own middleware, upstream of the handler, for request-specific props. Page props override shared props.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close