Working on received marker

This commit is contained in:
2023-11-27 01:04:40 +00:00
parent c12ded9318
commit e31db2f5e8
6 changed files with 74 additions and 4 deletions

View File

@@ -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