Update the search component to send event for updating the query.

This commit is contained in:
2025-04-04 11:20:06 +03:00
parent 0150095233
commit 4626ff8a29
4 changed files with 24 additions and 5 deletions
@@ -186,4 +186,13 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Index do
{:noreply, push_patch(socket, to: ~p"/authors?#{params}")}
end
@impl true
def handle_event("search", %{"query" => query}, socket) do
params =
socket.assigns.params
|> Map.put("query", query)
{:noreply, push_patch(socket, to: ~p"/authors?#{params}")}
end
end
@@ -250,4 +250,14 @@ defmodule DecentralisedBookIndexWeb.BookLive.Index do
)
end
end
@impl true
def handle_event("search", %{"query" => query}, socket) do
params =
socket.assigns.params
|> Map.put("query", query)
{:noreply, push_patch(socket, to: ~p"/books?#{params}")}
end
end