-
-
Save shankardevy/69c0f2ba3a172b3cbc5eb84eb0d9ccdf 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 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) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment