# `WardrikWeb.Router`

Adds the dashboard to a Phoenix router.

    import WardrikWeb.Router

    scope "/" do
      pipe_through :browser
      wardrik_dashboard "/wardrik", resolver: {MyAppWeb.WardrikResolver, []}
    end

  * The pipeline must fetch the session and check CSRF tokens. Phoenix's `:browser` pipeline
    does both.
  * The endpoint must serve the LiveView socket with the session:
    `socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]`.

# `wardrik_dashboard`
*macro* 

Mounts the dashboard at `path`.

## Options

* `:resolver` (tuple of `t:atom/0`, `t:term/0` values) - Required. The `WardrikWeb.Resolver` to use, as `{module, opts}`.

* `:on_mount` (list of `t:term/0`) - Your `on_mount` hooks, for example the one that loads the signed-in user. They run before the resolver. The default value is `[]`.

* `:extensions` (list of `t:atom/0`) - The `WardrikWeb.Extension` modules to add. The default value is `[]`.

* `:settings` (`t:keyword/0`) - The settings pages to turn on, as `{module, opts}` for each page. `:servers`,
  `:secrets`, `:notify_targets` and `:oauth_apps` take a `WardrikWeb.Settings`.
  `:connections` takes a `WardrikWeb.Connections`. The default value is `[]`.

  * `:servers`

  * `:secrets`

  * `:notify_targets`

  * `:oauth_apps`

  * `:connections`

* `:socket_path` (`t:String.t/0`) - The path of the endpoint's LiveView socket. The default value is `"/live"`.

* `:sign_in` (`t:String.t/0`) - The path to redirect to when the resolver refuses access. The default value is `"/"`.

* `:live_session` (`t:atom/0`) - The name of the live session. Set a different name for each dashboard if you mount more than one. The default value is `:wardrik_web`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
