diff --git a/web/controllers/api/game_controller.ex b/web/controllers/api/game_controller.ex index 9b03e56..eac8b71 100644 --- a/web/controllers/api/game_controller.ex +++ b/web/controllers/api/game_controller.ex @@ -14,9 +14,7 @@ defmodule Chess.Api.GameController do case Repo.update(changeset) do {:ok, game} -> - render conn, "show.json", game: game - {:error, changeset} -> - render(conn, "edit.html", game: game, changeset: changeset) + render(conn, "show.json", game: game) end end diff --git a/web/controllers/game_controller.ex b/web/controllers/game_controller.ex index dc90bae..c5a06ec 100644 --- a/web/controllers/game_controller.ex +++ b/web/controllers/game_controller.ex @@ -27,26 +27,6 @@ defmodule Chess.GameController do render(conn, "show.html", game: game) end - def edit(conn, %{"id" => id}) do - game = Repo.get!(Game, id) - changeset = Game.changeset(game) - render(conn, "edit.html", game: game, changeset: changeset) - end - - def update(conn, %{"id" => id, "game" => game_params}) do - game = Repo.get!(Game, id) - changeset = Game.changeset(game, game_params) - - case Repo.update(changeset) do - {:ok, game} -> - conn - |> put_flash(:info, "Game updated successfully.") - |> redirect(to: game_path(conn, :show, game)) - {:error, changeset} -> - render(conn, "edit.html", game: game, changeset: changeset) - end - end - def delete(conn, %{"id" => id}) do game = Repo.get!(Game, id) diff --git a/web/router.ex b/web/router.ex index 3dc4049..ec8fdd0 100644 --- a/web/router.ex +++ b/web/router.ex @@ -17,7 +17,7 @@ defmodule Chess.Router do pipe_through :browser # Use the default browser stack get "/", PageController, :index - resources "/games", GameController + resources "/games", GameController, only: [:create, :show, :delete] end # Other scopes may use custom stacks. diff --git a/web/templates/game/edit.html.eex b/web/templates/game/edit.html.eex deleted file mode 100644 index d9919d9..0000000 --- a/web/templates/game/edit.html.eex +++ /dev/null @@ -1,6 +0,0 @@ -