Skip to content

Commit

Permalink
fix: ninja admin view
Browse files Browse the repository at this point in the history
  • Loading branch information
ruilopesm committed Oct 14, 2023
1 parent 2bc4e85 commit b462a0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bokken_web/controllers/admin/ninja/ninja_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule BokkenWeb.Admin.NinjaController do
ninja = Accounts.get_ninja!(id, [:guardian])

with {:ok, %Ninja{} = ninja} <- Accounts.update_ninja(ninja, ninja_params) do
render(conn, :ninja, ninja: ninja)
render(conn, :show, ninja: ninja)
end
end
end
4 changes: 4 additions & 0 deletions lib/bokken_web/controllers/admin/ninja/ninja_json.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ defmodule BokkenWeb.Admin.NinjaJSON do
%{data: for(ninja <- ninjas, do: data(ninja))}
end

def show(%{ninja: ninja}) do
%{data: data(ninja)}
end

def data(%Ninja{} = ninja) do
%{
id: ninja.id,
Expand Down

0 comments on commit b462a0f

Please sign in to comment.