Skip to content

Commit

Permalink
add content to handle info call
Browse files Browse the repository at this point in the history
  • Loading branch information
electronicbites committed May 14, 2024
1 parent f79a151 commit 6032e20
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/radiator_web/live/episode_live/index.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
defmodule RadiatorWeb.EpisodeLive.Index do
use RadiatorWeb, :live_view

alias Radiator.Outline
alias Radiator.Outline.{Dispatch, NodeRepository}
alias Radiator.Outline.Event.{NodeContentChangedEvent, NodeInsertedEvent}
alias Radiator.Podcast
Expand Down Expand Up @@ -67,13 +66,13 @@ defmodule RadiatorWeb.EpisodeLive.Index do
|> reply(:noreply)
end

def handle_event("delete_node", %{"uuid" => uuid}, socket) do
def handle_event("delete_node", %{"uuid" => _uuid}, socket) do
_event_id = generate_event_id(socket.id)

case NodeRepository.get_node(uuid) do
nil -> nil
node -> Outline.remove_node(node, socket.id)
end
# case NodeRepository.get_node(uuid) do
# nil -> nil
# node -> Outline.remove_node(node, socket.id)
# end

socket
|> reply(:noreply)
Expand All @@ -95,9 +94,12 @@ defmodule RadiatorWeb.EpisodeLive.Index do
|> reply(:noreply)
end

def handle_info(%NodeContentChangedEvent{node_id: node_id, event_id: event_id}, socket) do
def handle_info(
%NodeContentChangedEvent{node_id: id, content: content},
socket
) do
socket
|> push_event("update", %{node_id: node_id, event_id: event_id})
|> push_event("update", %{node: %{id: id, content: content}})
|> reply(:noreply)
end

Expand Down

0 comments on commit 6032e20

Please sign in to comment.