Created
May 5, 2016 14:31
-
-
Save Fadhil/41af79c0aad898bb34eb2af9502624ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Plug.Anonymous do | |
import Plug.Conn | |
require IEx | |
def init(options), do: options | |
def call(conn, _opts) do | |
anonymous_id = get_session(conn, :anonymous_id) | |
case anonymous_id do | |
nil -> put_session(conn, :anonymous_id, "Testing") | |
_ -> conn | |
end | |
# case conn.cookies do | |
# %{anonymous_id: _id} -> conn | |
# _ -> conn |> put_resp_cookie("anonymous_id", "testing") | |
# end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment