Skip to content

Instantly share code, notes, and snippets.

@Ninigi Ninigi/shop_controller.ex

Last active Oct 8, 2018
Embed
What would you like to do?
defmodule UselessWeb.ShopController do
# ...
def new(conn, %{"hmac" => _, "shop" => shopify_domain}) do
shop = ShopifyApp.find_shop_by(%{shopify_domain: shopify_domain})
conn
|> put_layout({UselessWeb.EmbeddedAppView, "layout.html"})
|> render("show.html", shop: shop)
end
def new(conn, %{"shop" => shop_name}) when is_bitstring(shop_name),
do: signup(conn, %{"shop" => %{"shopify_domain" => shop_name}})
def new(conn, _params) do
changeset = ShopifyApp.change_shop(%Shop{})
render(conn, "new.html", changeset: changeset)
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.