Improve list view and add cookie
This commit is contained in:
16
lib/wish_web/layout.ex
Normal file
16
lib/wish_web/layout.ex
Normal file
@@ -0,0 +1,16 @@
|
||||
defmodule WishWeb.Plug.GetLayoutFromCookie do
|
||||
import Plug.Conn
|
||||
|
||||
def init(_) do
|
||||
%{}
|
||||
end
|
||||
|
||||
def call(conn, _opts) do
|
||||
conn = fetch_cookies(conn)
|
||||
|
||||
case conn.cookies["user_display"] do
|
||||
nil -> conn
|
||||
other -> conn |> put_session(:user_display, other)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user