refactor: Use submit_form wrapper in all LiveView forms
- Replace AshPhoenix.Form.submit with submit_form/3 wrapper - Import current_actor and submit_form from LiveHelpers - Consistent actor handling in all form submissions
This commit is contained in:
parent
897677a782
commit
77ae5c4888
7 changed files with 22 additions and 13 deletions
|
|
@ -33,7 +33,7 @@ defmodule MvWeb.CustomFieldValueLive.Form do
|
|||
use MvWeb, :live_view
|
||||
|
||||
on_mount {MvWeb.LiveHelpers, :ensure_user_role_loaded}
|
||||
import MvWeb.LiveHelpers, only: [current_actor: 1]
|
||||
import MvWeb.LiveHelpers, only: [current_actor: 1, submit_form: 3]
|
||||
|
||||
@impl true
|
||||
def render(assigns) do
|
||||
|
|
@ -228,7 +228,9 @@ defmodule MvWeb.CustomFieldValueLive.Form do
|
|||
custom_field_value_params
|
||||
end
|
||||
|
||||
case AshPhoenix.Form.submit(socket.assigns.form, params: updated_params) do
|
||||
actor = current_actor(socket)
|
||||
|
||||
case submit_form(socket.assigns.form, updated_params, actor) do
|
||||
{:ok, custom_field_value} ->
|
||||
notify_parent({:saved, custom_field_value})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue