          {:ok, admin} <- Users.auth_admin(email, password) do
         conn
         |> Guardian.Plug.sign_in(admin)
-        |> redirect(to: offer_path(:index))
+        |> redirect(to: offer_path(conn, :index))
     else
       _ ->
         conn

    end
  end

  def delete(conn, params) do
    conn
    |> Guardian.Plug.sign_out()
    |> redirect(to: offer_path(:index))
  end
end

defmodule ElixirJobsWeb.AuthController do
  use ElixirJobsWeb, :controller

  alias ElixirJobs.Users
  alias ElixirJobsWeb.Guardian

  plug :scrub_params, "auth" when action in [:create]

