Working on received marker
This commit is contained in:
@@ -18,4 +18,17 @@ defmodule WishWeb.HomeLive.Index do
|
||||
|
||||
{:noreply, assign(socket, :display, new_state)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("toggle_received", %{"id" => id}, socket) do
|
||||
item = Wishlist.get_item!(id)
|
||||
|
||||
case Wishlist.toggle_received(item) do
|
||||
{:ok, updated_item} ->
|
||||
{:noreply, assign(socket, :item, updated_item)}
|
||||
|
||||
{:error, _} ->
|
||||
{:noreply, socket}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user