             conn = put_flash(conn, :error, "Error in repsone that was received from slack")
           _ ->
             conn = set_user_from_response(conn, body)
-            # 
         end
       {:error, %HTTPoison.Error{reason: reason}} ->
           conn = put_flash(conn, :error, "Bad Request sent to slack")
     end
-    render conn, "new.html"
+    redirect(conn, to: page_path(conn, :index))
   end
 
   def destroy(conn, _params) do
     conn
     |> clear_session
-    |> redirect to: page_path(conn, :index)
+    |> redirect(to: page_path(conn, :index))
   end
 
   defp set_user_from_response(conn, body) do

      {:ok, %HTTPoison.Response{status_code: status_code, body: body}} ->
       %{"user" => %{"id" => slack_id , "name" => name, "profile" => %{"real_name" => real_name}}} = Poison.decode!(body)
       conn = put_session(conn, :user, [team_name: team_name, team_id: team_id, user_id: user_id])
      {:error, %HTTPoison.Error{reason: reason}} ->
        conn = put_flash(conn, :error, "Error in repsone when using API call to get user info from token")
    end  

    repsone = HTTPoison.get(get_url)   

    conn
  end



defmodule Spaces.SessionController do
  use Spaces.Web, :controller
  alias Spaces.User

  require IEx

  def index(conn, _params) do
