Skip to content

Commit

Permalink
Send 401 on cancel and order info reqs when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsamson committed Feb 14, 2016
1 parent a04439e commit e679296
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/controllers/venue_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ defmodule Stackfooter.VenueController do
{:ok, order} ->
order = Map.delete(order, :__struct__) |> Map.put(:ok, true)
conn |> json(order)
{:error, msg} -> conn |> json(msg)
{:error, msg} ->
conn |> put_status(401) |> json(msg)
end
:error ->
conn |> json(%{"ok" => false, "error" => "Invalid order id. Please supply an integer"})
Expand All @@ -71,7 +72,8 @@ defmodule Stackfooter.VenueController do
{:ok, cancelled_order} ->
cancelled_order = Map.delete(cancelled_order, :__struct__) |> Map.put(:ok, true)
conn |> json(cancelled_order)
{:error, msg} -> conn |> json(msg)
{:error, msg} ->
conn |> put_status(401) |> json(msg)
end
:error ->
conn |> json(%{"ok" => false, "error" => "Invalid order id. Please supply an integer"})
Expand Down

0 comments on commit e679296

Please sign in to comment.