You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
467 B

defmodule ChirpWeb.PostLive.Show do
use ChirpWeb, :live_view
alias Chirp.Timeline
@impl true
def mount(_params, _session, socket) do
{:ok, socket}
end
@impl true
def handle_params(%{"id" => id}, _, socket) do
{:noreply,
socket
|> assign(:page_title, page_title(socket.assigns.live_action))
|> assign(:post, Timeline.get_post!(id))}
end
defp page_title(:show), do: "Show Post"
defp page_title(:edit), do: "Edit Post"
end