defmodule AshAuthentication.Phoenix.Web do @moduledoc false alias AshAuthentication.Phoenix.{LayoutView, Utils.Flash, Web} @doc false def view do quote do use Phoenix.View, root: "lib/ash_authentication_phoenix/templates", namespace: Web # Import convenience functions from controllers import Phoenix.Controller, only: [view_module: 1, view_template: 1] use Phoenix.Component end end @doc false def live_view do quote do use Phoenix.LiveView, layout: {LayoutView, :live} on_mount Flash end end @doc false def live_component do quote do use Phoenix.LiveComponent import Flash, only: [put_flash!: 3] end end @doc false def component do quote do use Phoenix.Component import Flash, only: [put_flash!: 3] end end @doc """ When used, dispatch to the appropriate controller/view/etc. """ defmacro __using__(which) when is_atom(which) do apply(__MODULE__, which, []) end end