This one has code

September 25, 2024 instancer-kirik

defp apply_action(socket, :index, params) do

sort_direction = String.to_existing_atom(params["sort"] || "desc")
socket
|> assign(:page_title, "Listing Posts")
|> assign(:post, nil)
|> assign(:current_tag, nil)
|> assign(:sort_direction, sort_direction)
|> stream(:posts, fetch_posts(nil, sort_direction), reset: true)

end

@impl true def handle_info({TyperWeb.PostLive.FormComponent, {:saved, post}}, socket) do

{:noreply, stream_insert(socket, :posts, post)}

end

Comments

instancer-kirik

yikes, the indentation not working

2024-09-25 20:20:29

Please log in to add a comment.