 defmodule UserApp.SessionController do
   use UserApp.Web, :controller
 
-  alias UserApp.{Auth, User, Repo}
+  alias UserApp.{Auth, User, Repo, Host}
 
   def index(conn, _params) do
     users =

    |> render("error.json", reason: "User does not exist")
  end

  defp delete_host_from_user(conn) do
    user = Guardian.Plug.current_resource(conn)

    User.host_changeset(user, %{host_id: nil})
    |> Repo.update!

    |> Guardian.revoke!

    conn
    |> handle_logout
    |> put_status(:ok)
    |> render("delete.json", success: true)
  end
