Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get phx_value_id on handle_event("delete_user", id, socket) #57

Open
leductam opened this issue Feb 9, 2020 · 1 comment
Open

Comments

@leductam
Copy link

leductam commented Feb 9, 2020

I've downloaded the example and did some tests. But when tried the action Delete at Presence Example I got the error:

[error] GenServer #PID<0.596.0> terminating
** (Ecto.Query.CastError) deps/ecto/lib/ecto/repo/queryable.ex:411: value `%{"altKey" => false, "ctrlKey" => false, "id" => "21", "metaKey" => false, "offsetX" => 108, "offsetY" => 27, "pageX" => 633, "pageY" => 752, "screenX" => 1378, "screenY" => 329, "shiftKey" => false, "x" => 633, "y" => 195}` in `where` cannot be cast to type :id in query:

Seems can't get phx_value_id at templates->user->index.html.leex. And I have changed at below then it worked.

 def handle_event("delete_user", id, socket) do
    #user = Accounts.get_user!(id)
    user = Accounts.get_user!(id["id"])
    {:ok, _user} = Accounts.delete_user(user)

    {:noreply, socket}
  end

Please help to review.

@leductam leductam changed the title Can't not get phx_value_id on handle_event("delete_user", id, socket) Can't get phx_value_id on handle_event("delete_user", id, socket) Feb 9, 2020
@snewcomer
Copy link

You are correct! This was fixed in #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants