Update to remove unused code for the SelectPublisher component.
This commit is contained in:
@@ -40,36 +40,6 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.SelectPublisher do
|
|||||||
|> search()}
|
|> search()}
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
|
||||||
def handle_event("validate", %{"publisher" => publisher_params}, socket) do
|
|
||||||
{:noreply,
|
|
||||||
assign(socket, form: AshPhoenix.Form.validate(socket.assigns.form, publisher_params))}
|
|
||||||
end
|
|
||||||
|
|
||||||
def handle_event("save", %{"publisher" => publisher_id}, socket) do
|
|
||||||
notify_parent({:select_publisher, "416d2fc7-4470-4fde-aa64-501259335624"})
|
|
||||||
{:noreply, socket}
|
|
||||||
end
|
|
||||||
|
|
||||||
defp notify_parent(msg), do: send(self(), {__MODULE__, msg})
|
|
||||||
|
|
||||||
defp assign_form(%{assigns: %{publisher: publisher}} = socket) do
|
|
||||||
form =
|
|
||||||
if publisher do
|
|
||||||
AshPhoenix.Form.for_update(publisher, :update,
|
|
||||||
as: "publisher",
|
|
||||||
actor: socket.assigns.current_user
|
|
||||||
)
|
|
||||||
else
|
|
||||||
AshPhoenix.Form.for_create(DecentralisedBookIndex.Metadata.Publisher, :create,
|
|
||||||
as: "publisher",
|
|
||||||
actor: socket.assigns.current_user
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
assign(socket, form: to_form(form))
|
|
||||||
end
|
|
||||||
|
|
||||||
def handle_event("search", %{"query" => query}, socket) do
|
def handle_event("search", %{"query" => query}, socket) do
|
||||||
{:noreply,
|
{:noreply,
|
||||||
socket
|
socket
|
||||||
|
|||||||
Reference in New Issue
Block a user