Fix edit actions to allow create new data.
This commit is contained in:
@@ -34,7 +34,6 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Edit do
|
||||
socket
|
||||
|> assign(:params, params)
|
||||
|> apply_action(socket.assigns.live_action, params)
|
||||
|> redirect_if_not_editable()
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
@@ -46,6 +45,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Edit do
|
||||
:author,
|
||||
Ash.get!(Metadata.Author, id, load: [:dbi_server], actor: socket.assigns.current_user)
|
||||
)
|
||||
|> redirect_if_not_editable()
|
||||
end
|
||||
|
||||
defp apply_action(socket, :new, _params) do
|
||||
|
||||
@@ -31,7 +31,6 @@ defmodule DecentralisedBookIndexWeb.BookLive.Edit do
|
||||
socket =
|
||||
socket
|
||||
|> apply_action(socket.assigns.live_action, params)
|
||||
|> redirect_if_not_editable()
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
@@ -43,6 +42,7 @@ defmodule DecentralisedBookIndexWeb.BookLive.Edit do
|
||||
:book,
|
||||
Ash.get!(DecentralisedBookIndex.Metadata.Book, id, load: [:dbi_server], actor: socket.assigns.current_user)
|
||||
)
|
||||
|> redirect_if_not_editable()
|
||||
end
|
||||
|
||||
defp apply_action(socket, :new, _params) do
|
||||
|
||||
@@ -30,7 +30,6 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Edit do
|
||||
socket
|
||||
|> assign(:params, params)
|
||||
|> apply_action(socket.assigns.live_action, params)
|
||||
|> redirect_if_not_editable()
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
@@ -42,6 +41,7 @@ defmodule DecentralisedBookIndexWeb.PublisherLive.Edit do
|
||||
:publisher,
|
||||
Ash.get!(Metadata.Publisher, id, load: [:dbi_server], actor: socket.assigns.current_user)
|
||||
)
|
||||
|> redirect_if_not_editable()
|
||||
end
|
||||
|
||||
defp apply_action(socket, :new, _params) do
|
||||
|
||||
Reference in New Issue
Block a user