Skip to content

Instantly share code, notes, and snippets.


shankardevy/load_customer.ex Secret

Last active Aug 18, 2017
What would you like to do?
defmodule MangoWeb.Plugs.LoadCustomer do
import Plug.Conn
alias Mango.CRM
def init(_opts), do: nil
def call(conn, _opts) do
customer_id = get_session(conn, :customer_id)
customer = customer_id && CRM.get_customer(customer_id)
assign(conn, :current_customer, customer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment