Improve logic and add working "delete" links
This commit is contained in:
@ -8,8 +8,13 @@ defmodule OutlookWeb.ArtikelController do
|
||||
render(conn, :index, artikel: artikel, page_title: "Artikel")
|
||||
end
|
||||
|
||||
def show(conn, %{"id" => id}) do
|
||||
artikel = Artikel.get_artikel!(id)
|
||||
render(conn, :show, artikel: artikel, page_title: artikel.title)
|
||||
def show(conn, %{"tid" => tid} = params) do
|
||||
case Artikel.get_artikel_by_tid(tid) do
|
||||
{:ok, artikel} -> render(conn, :show, artikel: artikel, page_title: artikel.title)
|
||||
{:error, message} -> conn
|
||||
|> put_status(404)
|
||||
|> render(OutlookWeb.ErrorHTML, "404.html")
|
||||
|> halt()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user