Update the Authors Index LiveView to use the search_resource component.

This commit is contained in:
2025-04-17 12:21:07 +03:00
parent a3b5155337
commit a2c22319f0
3 changed files with 3 additions and 64 deletions
@@ -10,11 +10,13 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Index do
Listing Authors
</.header>
<.author_search
<.search_resources
search_query={@search_query}
select_options={@select_options}
selected_option={@sort_by}
current_user={@current_user}
resource_type="author"
resource_new_url={~p"/authors/new"}
/>
<%= if Enum.empty?(@page.results) do %>
@@ -66,10 +68,6 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Index do
def mount(_params, _session, socket) do
{:ok,
socket
|> stream(
:authors,
Ash.read!(DecentralisedBookIndex.Metadata.Author, actor: socket.assigns[:current_user])
)
|> assign_new(:current_user, fn -> nil end)}
end