Skip to content

Commit

Permalink
chore: Fix warnings related to params of AshPhoenix.Form.submit (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
aifrak authored Nov 4, 2024
1 parent 75f8e5a commit d045c6b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lib/ash_admin/components/resource/data_table.ex
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ defmodule AshAdmin.Components.Resource.DataTable do
[]
end

case AshPhoenix.Form.submit(socket.assigns.query, action_opts: action_opts) do
case AshPhoenix.Form.submit(socket.assigns.query,
action_opts: action_opts,
params: nil
) do
{:ok, data} -> assign(socket, :data, {:ok, data})
{:error, query} -> assign(socket, data: {:error, all_errors(query)}, query: query)
end
Expand Down
8 changes: 6 additions & 2 deletions lib/ash_admin/components/resource/form.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@ defmodule AshAdmin.Components.Resource.Form do
|> assign(:form, form)}
end

def handle_event("save", _, socket) do
def handle_event("save", %{"form" => form_params}, socket) do
form = socket.assigns.form

before_submit = fn changeset ->
Expand All @@ -1666,7 +1666,11 @@ defmodule AshAdmin.Components.Resource.Form do
|> Map.put(:actor, socket.assigns[:actor])
end

case AshPhoenix.Form.submit(form, before_submit: before_submit, force?: true) do
case AshPhoenix.Form.submit(form,
before_submit: before_submit,
force?: true,
params: form_params
) do
{:ok, result} ->
redirect_to(socket, result)

Expand Down
2 changes: 1 addition & 1 deletion lib/ash_admin/components/resource/generic_action.ex
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ defmodule AshAdmin.Components.Resource.GenericAction do
# []
# end

# case AshPhoenix.Form.submit(socket.assigns.query, action_opts: action_opts) do
# case AshPhoenix.Form.submit(socket.assigns.query, action_opts: action_opts, params: nil) do
# {:ok, data} -> assign(socket, :data, {:ok, data})
# {:error, query} -> assign(socket, data: {:error, all_errors(query)}, query: query)
# end
Expand Down

0 comments on commit d045c6b

Please sign in to comment.