Browse Source

feat: remove show from note controller

main
Inhji Y. 9 months ago
parent
commit
b9a710ee6c
  1. 13
      lib/mirage_web/controllers/note_controller.ex

13
lib/mirage_web/controllers/note_controller.ex

@ -26,22 +26,13 @@ defmodule MirageWeb.NoteController do
conn
|> put_flash(:info, "Note created successfully.")
|> redirect(to: Routes.note_path(conn, :show, note))
|> redirect(to: Routes.live_path(conn, MirageWeb.ShowNoteLive, note))
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "new.html", changeset: changeset)
end
end
def show(conn, %{"id" => id}) do
note =
id
|> Notes.get_note!()
|> Notes.preload_note()
render(conn, "show.html", note: note)
end
def edit(conn, %{"id" => id}) do
note =
id
@ -66,7 +57,7 @@ defmodule MirageWeb.NoteController do
conn
|> put_flash(:info, "Note updated successfully.")
|> redirect(to: Routes.note_path(conn, :show, note))
|> redirect(to: Routes.live_path(conn, MirageWeb.ShowNoteLive, note))
{:error, %Ecto.Changeset{} = changeset} ->
render(conn, "edit.html", note: note, changeset: changeset)

Loading…
Cancel
Save